forked from mirrors/gotosocial
add cache configuration to config parse tests
Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
9083772d03
commit
3091d4608d
4 changed files with 8 additions and 2 deletions
|
@ -183,7 +183,7 @@ type CacheConfig struct {
|
||||||
UserSweepFreq time.Duration `name:"user-sweep-freq"`
|
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) {
|
func (cfg *Configuration) MarshalMap() (map[string]interface{}, error) {
|
||||||
var dst map[string]interface{}
|
var dst map[string]interface{}
|
||||||
dec, _ := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
dec, _ := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
||||||
|
|
|
@ -41,8 +41,8 @@ func NewState() *ConfigState {
|
||||||
viper := viper.New()
|
viper := viper.New()
|
||||||
|
|
||||||
// Flag 'some-flag-name' becomes env var 'GTS_SOME_FLAG_NAME'
|
// Flag 'some-flag-name' becomes env var 'GTS_SOME_FLAG_NAME'
|
||||||
viper.SetEnvPrefix("gts")
|
|
||||||
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
|
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
|
||||||
|
viper.SetEnvPrefix("gts")
|
||||||
|
|
||||||
// Load appropriate named vals from env
|
// Load appropriate named vals from env
|
||||||
viper.AutomaticEnv()
|
viper.AutomaticEnv()
|
||||||
|
|
6
internal/config/testdata/test.yaml
vendored
6
internal/config/testdata/test.yaml
vendored
|
@ -409,3 +409,9 @@ syslog-protocol: "udp"
|
||||||
# String. Address:port to send syslog logs to. Leave empty to connect to local syslog.
|
# String. Address:port to send syslog logs to. Leave empty to connect to local syslog.
|
||||||
# Default: "localhost:514"
|
# Default: "localhost:514"
|
||||||
syslog-address: "localhost:514"
|
syslog-address: "localhost:514"
|
||||||
|
|
||||||
|
# Cache configuration
|
||||||
|
cache:
|
||||||
|
account-max-size: 99
|
||||||
|
account-ttl: "3h"
|
||||||
|
account-sweep-freq: "1s"
|
Loading…
Reference in a new issue