add cache configuration to config parse tests

Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
kim 2022-12-09 22:10:15 +00:00
parent 9083772d03
commit 3091d4608d
4 changed files with 8 additions and 2 deletions

View file

@ -183,7 +183,7 @@ type CacheConfig struct {
UserSweepFreq time.Duration `name:"user-sweep-freq"`
}
// MarshalMap will marshal current Configuration into a map structure (useful for JSON).
// MarshalMap will marshal current Configuration into a map structure (useful for JSON/TOML/YAML).
func (cfg *Configuration) MarshalMap() (map[string]interface{}, error) {
var dst map[string]interface{}
dec, _ := mapstructure.NewDecoder(&mapstructure.DecoderConfig{

View file

@ -41,8 +41,8 @@ func NewState() *ConfigState {
viper := viper.New()
// Flag 'some-flag-name' becomes env var 'GTS_SOME_FLAG_NAME'
viper.SetEnvPrefix("gts")
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
viper.SetEnvPrefix("gts")
// Load appropriate named vals from env
viper.AutomaticEnv()

View file

@ -409,3 +409,9 @@ syslog-protocol: "udp"
# String. Address:port to send syslog logs to. Leave empty to connect to local syslog.
# Default: "localhost:514"
syslog-address: "localhost:514"
# Cache configuration
cache:
account-max-size: 99
account-ttl: "3h"
account-sweep-freq: "1s"