Documentation
¶
Overview ¶
Package bootstrap is a package that provides the bootstrap information for the service.
Package bootstrap implements the functions, types, and interfaces for the module.
Package bootstrap implements the functions, types, and interfaces for the module.
Package bootstrap implements the functions, types, and interfaces for the module.
Index ¶
- Constants
- Variables
- func LoadLocalConfig(bs *Bootstrap, v any) error
- func LoadSourceConfig(bootstrap *Bootstrap) (*configv1.SourceConfig, error)
- func LoadSourceConfigFromPath(path string) (*configv1.SourceConfig, error)
- func RandomID() 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 Option
- type Options
- type SaveOption
Constants ¶
const ( DefaultConfigPath = "configs/config.toml" DefaultEnv = "release" DefaultWorkDir = "." )
Constants for default paths and environment
const ( DefaultServiceName = "origadmin.service.v1" DefaultVersion = "v1.0.0" )
Variables ¶
var (
RandomSuffix = fmt.Sprintf("%08d", time.Now().UnixNano()%(1<<32))
)
Functions ¶
func LoadLocalConfig ¶
LoadLocalConfig 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 LoadSourceConfigFromPath ¶
func LoadSourceConfigFromPath(path string) (*configv1.SourceConfig, error)
LoadSourceConfigFromPath loads the config file from the given path
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 Option ¶ added in v0.1.0
type Option = func(option *Options)
Option is a function that takes a pointer to a Options struct and modifies it.
func WithEnvPrefix ¶ added in v0.1.0
type SaveOption ¶ added in v0.0.2
type SaveOption = func(*protojson.MarshalOptions)
SaveOption represents an option for saving configuration data.