Initialize configs correctly, move notification config (#8367)

This PR also removes deprecated tests, adds checks
to avoid races reproduced on CI/CD.
This commit is contained in:
Harshavardhana
2019-10-08 23:11:15 -07:00
committed by kannappanr
parent d2a8be6fc2
commit 6a4ef2e48e
15 changed files with 149 additions and 321 deletions

View File

@@ -51,6 +51,30 @@ const (
defaultTarget = "_"
)
// NewConfig - initialize new logger config.
func NewConfig() Config {
cfg := Config{
// Console logging is on by default
Console: Console{
Enabled: true,
},
HTTP: make(map[string]HTTP),
Audit: make(map[string]HTTP),
}
// Create an example HTTP logger
cfg.HTTP[defaultTarget] = HTTP{
Endpoint: "https://username:password@example.com/api",
}
// Create an example Audit logger
cfg.Audit[defaultTarget] = HTTP{
Endpoint: "https://username:password@example.com/api/audit",
}
return cfg
}
// LookupConfig - lookup logger config, override with ENVs if set.
func LookupConfig(cfg Config) (Config, error) {
envs := env.List(EnvLoggerHTTPEndpoint)