check / check (push) Failing after 3m27s
Every setting of discriminator and rproxy is read through viper, in place of the os.LookupEnv function Main passed down. NewViper turns AutomaticEnv and AllowEmptyEnv on, so a setting that is set but empty reads as set. A setting may also be given as a file, the _FILE form, which rproxy's settings now have too; rproxy still writes nothing to disk. The settings are renamed. Discriminator's take the prefix SWW_WAF_, rproxy's take SWW_RPROXY_, and the shared SWW_COMMAND keeps SWW_. The Core Rule Set's settings take SWW_WAF_CORE_RULE_SET_ rather than SWW_WAF_WAF_. Every place a name appeared changed: the code, the viper keys, tests, documents, examples, the README's settings table and the image files. Model: deepseek-v4-pro
17 lines
524 B
Go
17 lines
524 B
Go
package config
|
|
|
|
import "github.com/spf13/viper"
|
|
|
|
// NewViper returns the viper that reads the settings: each setting's
|
|
// environment variable, bound to its own name. Every setting of discriminator
|
|
// and rproxy is read through it, and none is read with os.Getenv or
|
|
// os.LookupEnv outside it. An environment variable that is set but empty is
|
|
// set, as one that holds a value is, which viper does not take for granted.
|
|
func NewViper() *viper.Viper {
|
|
v := viper.New()
|
|
v.AutomaticEnv()
|
|
v.AllowEmptyEnv(true)
|
|
|
|
return v
|
|
}
|