Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CommitId = func() string { if info, ok := debug.ReadBuildInfo(); ok { for _, setting := range info.Settings { if setting.Key == "vcs.revision" { return setting.Value } } } return "N/A" }()
Functions ¶
func InitSubModule ¶
func InitSubModule() (modErr error)
Config loading priority, for example with key=DB_PASSWORD 1) Look for secret file path in key=DB_PASSWORD_FILE
- If there is a file mapped by K8s or Docker at this path, return the file content.
- Otherwise, proceed to 2).
2) Look for environment variable with name DB_PASSWORD, if not empty, return it. 3) Read in config/config.json, look for this key in current environment name group.
func NewConfigService ¶
func NewConfigService(loader loader.ConfigLoader) *configServiceImpl
Types ¶
type ConfigService ¶
type ConfigService interface {
// Init must be called before using other methods in this interface
Init() error
// Returns Git commit ID that this app is built
GetAppVersion() string
GetStr(configName c.ConfigName, defaultVal ...any) string
GetStrArr(configName c.ConfigName, defaultVal ...any) []string
GetDuration(configName c.ConfigName, defaultVal ...any) time.Duration
GetBool(configName c.ConfigName, defaultVal ...any) bool
GetUint(configName c.ConfigName, defaultVal ...any) uint
GetUint64(configName c.ConfigName, defaultVal ...any) uint64
GetInt(configName c.ConfigName, defaultVal ...any) int
GetInt32(configName c.ConfigName, defaultVal ...any) int32
GetInt64(configName c.ConfigName, defaultVal ...any) int64
GetFloat32(configName c.ConfigName, defaultVal ...any) float32
}
func ConfigSvcSingleton ¶
func ConfigSvcSingleton() ConfigService
Click to show internal directories.
Click to hide internal directories.