Read every setting through viper (closes #211) #219

Open
clawbot wants to merge 1 commits from issue-211-viper-config into next
Collaborator

Every setting of rproxy and servewaf is now read through viper (github.com/spf13/viper), bound to the same environment variable names as before, in place of the os.LookupEnv function Main passed down.

config.NewViper turns AutomaticEnv and AllowEmptyEnv on; the latter keeps a setting that is set but empty reading as set, which viper does not do by default. FromEnvironment, RProxyFromEnvironment, Command, ServeWAFListenAddr, InstanceName and RProxyListenAddrAndUpstreamURL take the viper, and Params carries it instead of LookupEnv. No setting is read with os.Getenv or os.LookupEnv outside that viper.

The _FILE forms, their validation and errors, and rproxy reading no file form are unchanged. make check passes; the settings tests pass with the same names, defaults and errors, set into a viper instead of a lookup function.

Model: deepseek-v4-pro

Run usage: DeepSeek V4 Pro through OpenRouter, 794,970 input, 77,256 output, 107,400 reasoning and 74,666,496 cache-read tokens; cost $9.24.

Every setting of `rproxy` and `servewaf` is now read through viper (`github.com/spf13/viper`), bound to the same environment variable names as before, in place of the `os.LookupEnv` function `Main` passed down. `config.NewViper` turns `AutomaticEnv` and `AllowEmptyEnv` on; the latter keeps a setting that is set but empty reading as set, which viper does not do by default. `FromEnvironment`, `RProxyFromEnvironment`, `Command`, `ServeWAFListenAddr`, `InstanceName` and `RProxyListenAddrAndUpstreamURL` take the viper, and `Params` carries it instead of `LookupEnv`. No setting is read with `os.Getenv` or `os.LookupEnv` outside that viper. The `_FILE` forms, their validation and errors, and rproxy reading no file form are unchanged. `make check` passes; the settings tests pass with the same names, defaults and errors, set into a viper instead of a lookup function. Model: deepseek-v4-pro Run usage: DeepSeek V4 Pro through OpenRouter, 794,970 input, 77,256 output, 107,400 reasoning and 74,666,496 cache-read tokens; cost $9.24.
clawbot added the needs-review label 2026-11-07 04:03:57 +01:00
sneak was assigned by clawbot 2026-11-07 04:03:57 +01:00
clawbot added 1 commit 2026-11-07 04:03:57 +01:00
Read every setting through viper (closes #211)
check / check (push) Successful in 3m47s
9c755ee358
servewaf's and rproxy's settings are read through viper, bound to the same environment variable names as before, 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, as it did. The _FILE forms, their errors, and rproxy reading no file form are unchanged, and the settings tests pass set into a viper instead of a lookup function.

Model: deepseek-v4-pro
All checks were successful
check / check (push) Successful in 3m47s
You are not authorized to merge this pull request.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin issue-211-viper-config:issue-211-viper-config
git checkout issue-211-viper-config
Sign in to join this conversation.