@@ -21,8 +21,10 @@ type bouncerConfig struct {
21
21
LogMode string `yaml:"log_mode"`
22
22
LogDir string `yaml:"log_dir"`
23
23
LogLevel log.Level `yaml:"log_level"`
24
- APIUrl string `yaml:"api_url"`
25
- APIKey string `yaml:"api_key"`
24
+ CompressLogs * bool `yaml:"compress_logs,omitempty"`
25
+ LogMaxSize int `yaml:"log_max_size,omitempty"`
26
+ LogMaxFiles int `yaml:"log_max_files,omitempty"`
27
+ LogMaxAge int `yaml:"log_max_age,omitempty"`
26
28
CacheRetentionDuration time.Duration `yaml:"cache_retention_duration"`
27
29
}
28
30
@@ -36,13 +38,16 @@ func NewConfig(configPath string) (*bouncerConfig, error) {
36
38
return & bouncerConfig {}, fmt .Errorf ("failed to read %s : %v" , configPath , err )
37
39
}
38
40
39
- err = yaml .UnmarshalStrict (configBuff , & config )
41
+ err = yaml .Unmarshal (configBuff , & config )
40
42
if err != nil {
41
43
return & bouncerConfig {}, fmt .Errorf ("failed to unmarshal %s : %v" , configPath , err )
42
44
}
43
45
44
- if config .BinPath == "" || config .LogMode == "" {
45
- return & bouncerConfig {}, fmt .Errorf ("invalid configuration in %s" , configPath )
46
+ if config .BinPath == "" {
47
+ return & bouncerConfig {}, fmt .Errorf ("bin_path is not set" )
48
+ }
49
+ if config .LogMode == "" {
50
+ return & bouncerConfig {}, fmt .Errorf ("log_mode is not net" )
46
51
}
47
52
48
53
_ , err = os .Stat (config .BinPath )
@@ -51,7 +56,7 @@ func NewConfig(configPath string) (*bouncerConfig, error) {
51
56
}
52
57
53
58
/*Configure logging*/
54
- if err = types .SetDefaultLoggerConfig (config .LogMode , config .LogDir , config .LogLevel ); err != nil {
59
+ if err = types .SetDefaultLoggerConfig (config .LogMode , config .LogDir , config .LogLevel , config . LogMaxSize , config . LogMaxFiles , config . LogMaxAge , config . CompressLogs , false ); err != nil {
55
60
log .Fatal (err .Error ())
56
61
}
57
62
if config .LogMode == "file" {
0 commit comments