Documentation ¶
Overview ¶
Package bootstrap implements the functions, types, and interfaces for the module.
Package bootstrap implements the functions, types, and interfaces for the module.
Index ¶
- Constants
- func LoadLocalConfig(bs *Bootstrap, v any) error
- func LoadPathSourceConfig(path string) (*configv1.SourceConfig, error)
- func LoadRemoteConfig(bootstrap *Bootstrap, v any, ss ...config.SourceOptionSetting) error
- func LoadSourceConfig(bootstrap *Bootstrap) (*configv1.SourceConfig, error)
- func RandomTimeID() string
- func SaveConfig(path string, data any, opts ...SaveOption) error
- type Bootstrap
- func (b *Bootstrap) ID() string
- func (b *Bootstrap) Metadata() map[string]string
- func (b *Bootstrap) ServiceID() string
- func (b *Bootstrap) ServiceName() string
- func (b *Bootstrap) SetFlags(name, version string)
- func (b *Bootstrap) StartTime() time.Time
- func (b *Bootstrap) Version() string
- func (b *Bootstrap) WorkPath() string
- type Flags
- type SaveOption
Constants ¶
const ( DefaultConfigPath = "configs/config.toml" DefaultEnv = "dev" DefaultWorkDir = "." )
Constants for default paths and environment
const ( DefaultServiceName = "origadmin.service.v1" DefaultVersion = "v1.0.0" )
Variables ¶
This section is empty.
Functions ¶
func LoadLocalConfig ¶
LoadLocalConfig loads the config file from the given path
func LoadPathSourceConfig ¶ added in v0.0.2
func LoadPathSourceConfig(path string) (*configv1.SourceConfig, error)
LoadPathSourceConfig loads the config file from the given path
func LoadRemoteConfig ¶
func LoadRemoteConfig(bootstrap *Bootstrap, v any, ss ...config.SourceOptionSetting) error
LoadRemoteConfig loads the config file from the given path
func LoadSourceConfig ¶
func LoadSourceConfig(bootstrap *Bootstrap) (*configv1.SourceConfig, error)
LoadSourceConfig loads the config file from the given path
func RandomTimeID ¶ added in v0.0.7
func RandomTimeID() string
func SaveConfig ¶ added in v0.0.2
func SaveConfig(path string, data any, opts ...SaveOption) error
SaveConfig saves the configuration data to the specified file path.
Types ¶
type Bootstrap ¶
Bootstrap struct to hold bootstrap information
func DefaultBootstrap ¶
func DefaultBootstrap() *Bootstrap
DefaultBootstrap returns a default bootstrap
func (*Bootstrap) ServiceName ¶
ServiceName returns the service name
type Flags ¶
type Flags struct { ID string Version string ServiceName string StartTime time.Time Metadata map[string]string }
Flags is a struct that holds the flags for the service
func DefaultFlags ¶
func DefaultFlags() Flags
DefaultFlags returns the default flags for the service
type SaveOption ¶ added in v0.0.2
type SaveOption = func(*protojson.MarshalOptions)
SaveOption represents an option for saving configuration data.