bump log level when overloading config file with .local (#1646)

* bump log level

Co-authored-by: Marco Mariani <marco@crowdsec.net>
This commit is contained in:
Thibault "bui" Koechlin 2022-07-08 09:29:23 +02:00 committed by GitHub
parent 37ada58f3a
commit 73f336363a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -60,7 +60,7 @@ func (p *Patcher) MergedPatchContent() ([]byte, error) {
return nil, err
}
if err == nil {
log.Debugf("Patching yaml: '%s' with '%s'", p.BaseFilePath, p.PatchFilePath)
log.Infof("Patching yaml: '%s' with '%s'", p.BaseFilePath, p.PatchFilePath)
}
var patched *bytes.Buffer

View file

@ -33,22 +33,22 @@ teardown() {
@test "config.yaml.local - cscli (log_level)" {
config_set '.common.log_level="warning"'
run -0 cscli config show --key Config.Common.LogLevel
run -0 --separate-stderr cscli config show --key Config.Common.LogLevel
assert_output "warning"
echo "{'common':{'log_level':'debug'}}" >"${CONFIG_YAML}.local"
run -0 cscli config show --key Config.Common.LogLevel
run -0 --separate-stderr cscli config show --key Config.Common.LogLevel
assert_output "debug"
}
@test "config.yaml.local - cscli (log_level - with envvar)" {
config_set '.common.log_level="warning"'
run -0 cscli config show --key Config.Common.LogLevel
run -0 --separate-stderr cscli config show --key Config.Common.LogLevel
assert_output "warning"
export CROWDSEC_LOG_LEVEL=debug
echo "{'common':{'log_level':'${CROWDSEC_LOG_LEVEL}'}}" >"${CONFIG_YAML}.local"
run -0 cscli config show --key Config.Common.LogLevel
run -0 --separate-stderr cscli config show --key Config.Common.LogLevel
assert_output "debug"
}
@ -108,7 +108,7 @@ teardown() {
}
@test "profiles.yaml.local" {
run -0 config_get '.api.server.profiles_path'
run -0 --separate-stderr config_get '.api.server.profiles_path'
refute_output null
PROFILES="${output}"
@ -131,7 +131,7 @@ teardown() {
fake_log >>"${tmpfile}"
sleep 1
rm -f -- "${tmpfile}"
run -0 cscli decisions list -o json
run -0 --separate-stderr cscli decisions list -o json
run -0 jq -c '.[].decisions[0] | [.value,.type]' <(output)
assert_output '["1.1.1.172","captcha"]'
}