Documentation
¶
Index ¶
- Variables
- func AllSettings() map[string]interface{}
- func BindEnv()
- func Get(key string) interface{}
- func GetBool(key string) bool
- func GetDuration(key string) time.Duration
- func GetFloat64(key string) float64
- func GetInt(key string) int
- func GetIntSlice(key string) []int
- func GetString(key string) string
- func GetStringMap(key string) map[string]interface{}
- func GetStringMapString(key string) map[string]string
- func GetStringSlice(key string) []string
- func GetTime(key string) time.Time
- func IsSet(key string) bool
- func SetDefaultConfig()
- type Config
- type ConfigDB
- type ConfigJWT
- type ConfigLogger
- type ConfigServer
Constants ¶
This section is empty.
Variables ¶
View Source
var CfgFileFlag string
View Source
var Flags pflag.FlagSet
Functions ¶
func AllSettings ¶
func AllSettings() map[string]interface{}
func GetDuration ¶
func GetFloat64 ¶
func GetIntSlice ¶
func GetStringMap ¶
func GetStringMapString ¶
func GetStringSlice ¶
func SetDefaultConfig ¶
func SetDefaultConfig()
Types ¶
type Config ¶
type Config struct { Server ConfigServer `mapstructure:"server"` DB ConfigDB `mapstructure:"db"` Logger ConfigLogger `mapstructure:"logger"` JWT ConfigJWT `mapstructure:"jwt"` }
var ServerConfig *Config
func (*Config) ApplyConfig ¶
func (c *Config) ApplyConfig()
ApplyConfig reads and applies all configurations in the following order of priority: 1. Command line flags 2. Environment variables 3. Config file 4. Default values If a config file is specified, it will be read from the specified path Otherwise, the config file will be read from the default path
type ConfigLogger ¶
type ConfigLogger struct {
Level string `mapstructure:"level"`
}
type ConfigServer ¶
Click to show internal directories.
Click to hide internal directories.