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.
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
- type Bootstrap
- func (b *Bootstrap) ConfigFilePath() string
- func (b *Bootstrap) ConfigPath() string
- func (b *Bootstrap) Daemon() bool
- func (b *Bootstrap) Env() string
- func (b *Bootstrap) IsDebug() bool
- func (b *Bootstrap) Metadata() map[string]string
- func (b *Bootstrap) ServiceID() string
- func (b *Bootstrap) ServiceInfo() ServiceInfo
- func (b *Bootstrap) ServiceName() string
- func (b *Bootstrap) SetConfigPath(configPath string)
- func (b *Bootstrap) SetDaemon(daemon bool)
- func (b *Bootstrap) SetEnv(env string)
- func (b *Bootstrap) SetMetadata(metadata map[string]string)
- func (b *Bootstrap) SetPath(dir, configPath string)
- func (b *Bootstrap) SetServiceID(serviceID string)
- func (b *Bootstrap) SetServiceInfo(name, version string)
- func (b *Bootstrap) SetServiceName(serviceName string)
- func (b *Bootstrap) SetStartTime(startTime time.Time)
- func (b *Bootstrap) SetVersion(version string)
- func (b *Bootstrap) SetWorkDir(workDir string)
- func (b *Bootstrap) StartTime() time.Time
- func (b *Bootstrap) Version() string
- func (b *Bootstrap) WorkDir() string
- type Loader
- type Option
- type Options
- type ServiceInfo
Constants ¶
const ( EnvRelease = "release" EnvDebug = "debug" DefaultConfigPath = "configs/config.toml" 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
Types ¶
type Bootstrap ¶
type Bootstrap struct {
// contains filtered or unexported fields
}
Bootstrap struct to hold bootstrap information
func (*Bootstrap) ConfigFilePath ¶ added in v0.1.57
func (*Bootstrap) ConfigPath ¶
func (*Bootstrap) ServiceInfo ¶ added in v0.1.59
func (b *Bootstrap) ServiceInfo() ServiceInfo
func (*Bootstrap) ServiceName ¶
func (*Bootstrap) SetConfigPath ¶ added in v0.1.57
func (*Bootstrap) SetMetadata ¶ added in v0.1.57
func (*Bootstrap) SetServiceID ¶ added in v0.1.57
func (*Bootstrap) SetServiceInfo ¶ added in v0.1.57
func (*Bootstrap) SetServiceName ¶ added in v0.1.57
func (*Bootstrap) SetStartTime ¶ added in v0.1.57
func (*Bootstrap) SetVersion ¶ added in v0.1.57
func (*Bootstrap) SetWorkDir ¶ added in v0.1.57
type Loader ¶ added in v0.1.57
type Loader interface {
Load() (*configv1.SourceConfig, error)
Reload() error
}
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 ServiceInfo ¶ added in v0.1.59
ServiceInfo is a struct that holds the flags for the service
func NewServiceInfo ¶ added in v0.1.59
func NewServiceInfo(name, version string) ServiceInfo
func (ServiceInfo) ServiceID ¶ added in v0.1.59
func (si ServiceInfo) ServiceID() string
ServiceID returns the ID of the service