Documentation ¶
Index ¶
- func Cover(path string, config *Config) error
- func Exist(path string) (bool, error)
- func GetStringSlicePreserveString(cfg Provider, key string) []string
- func MakeDir(path string) error
- func RandSecret() ([]byte, error)
- type Config
- type DBConfig
- type DBType
- type InfluxDBConfig
- type LogConfig
- type LogHookType
- type Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStringSlicePreserveString ¶
GetStringSlicePreserveString returns a string slice from the given config and key. It differs from the GetStringSlice method in that if the config value is a string, we do not attempt to split it into fields.
func RandSecret ¶
RandSecret If the daemon does not have a secret key configured, it is automatically generated
Types ¶
type Config ¶
type Config struct { Port string `json:"port"` Secret string `json:"secret"` ReadTimeout time.Duration `json:"readTimeout"` WriteTimeout time.Duration `json:"writeTimeout"` IdleTimeout time.Duration `json:"idleTimeout"` Log *LogConfig `json:"log"` DB *DBConfig `json:"db"` }
func DecodeConfig ¶
func DefaultConfig ¶
type InfluxDBConfig ¶
type LogConfig ¶
type LogConfig struct { LogLevel string `json:"logLevel"` Type LogHookType `json:"type"` HookSwitch bool `json:"hookSwitch"` InfluxDB *InfluxDBConfig `json:"influxdb"` }
type Provider ¶
type Provider interface { GetString(key string) string GetInt(key string) int GetBool(key string) bool GetStringMap(key string) map[string]interface{} GetStringMapString(key string) map[string]string GetStringSlice(key string) []string Get(key string) interface{} Set(key string, value interface{}) IsSet(key string) bool WatchConfig() OnConfigChange(run func(in fsnotify.Event)) Unmarshal(rawVal interface{}, opts ...viper.DecoderConfigOption) error UnmarshalKey(key string, rawVal interface{}, opts ...viper.DecoderConfigOption) error }
func FromConfigString ¶
FromConfigString creates a config from the given YAML, JSON or TOML config. This is useful in tests.
Click to show internal directories.
Click to hide internal directories.