Viper counts an environment variable set to the empty string as unset, so IRC_LISTEN_ADDR= fell back to :6667 and the IRC listener could only be disabled through neoirc.yaml. config.New now also reads IRC_LISTEN_ADDR with os.LookupEnv: when the variable is set, its value is used, so the empty string disables the listener; when it is unset, the file's value or the :6667 default applies as before.
The new internal/config/config_test.go covers both cases. In README.md, the Configuration section names this as the one exception to "an empty environment variable counts as unset", the table row says how to disable the listener, and the IRC Protocol Listener section shows both the environment form and the neoirc.yaml form.
Judgement call: Viper does have a switch that honours empty environment variables (AllowEmptyEnv), but it applies to every setting at once, so PORT= or DBURL= would then mean an empty value instead of the default. That goes beyond this issue and contradicts what README.md documents, so only this one variable is read with os.LookupEnv.
Model: opus-5-5
Closes https://git.eeqj.de/sneak/neoirc/issues/124.
Viper counts an environment variable set to the empty string as unset, so `IRC_LISTEN_ADDR=` fell back to `:6667` and the IRC listener could only be disabled through `neoirc.yaml`. `config.New` now also reads `IRC_LISTEN_ADDR` with `os.LookupEnv`: when the variable is set, its value is used, so the empty string disables the listener; when it is unset, the file's value or the `:6667` default applies as before.
The new `internal/config/config_test.go` covers both cases. In `README.md`, the Configuration section names this as the one exception to "an empty environment variable counts as unset", the table row says how to disable the listener, and the IRC Protocol Listener section shows both the environment form and the `neoirc.yaml` form.
Judgement call: Viper does have a switch that honours empty environment variables (`AllowEmptyEnv`), but it applies to every setting at once, so `PORT=` or `DBURL=` would then mean an empty value instead of the default. That goes beyond this issue and contradicts what `README.md` documents, so only this one variable is read with `os.LookupEnv`.
Model: opus-5-5
Viper treats an environment variable set to the empty string as unset,
so an empty IRC_LISTEN_ADDR fell back to the :6667 default and the IRC
listener could not be disabled from the environment. The config now
reads IRC_LISTEN_ADDR with os.LookupEnv as well, so an empty value
disables the listener and an unset one keeps :6667. Viper's own switch
for this applies to every setting, so it is not used. New config tests
cover both cases, and README.md says how to disable the listener.
Model: opus-5-5
PASS: an IRC_LISTEN_ADDR set to the empty string now starts the server without the IRC listener, an unset one keeps :6667, and a value from neoirc.yaml still applies, which meets the definition of done in #124.
Model: opus-5-5
PASS: an `IRC_LISTEN_ADDR` set to the empty string now starts the server without the IRC listener, an unset one keeps `:6667`, and a value from `neoirc.yaml` still applies, which meets the definition of done in https://git.eeqj.de/sneak/neoirc/issues/124.
Model: opus-5-5
clawbot
merged commit 5b430cf835 into next2026-10-20 12:35:20 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #124.
Viper counts an environment variable set to the empty string as unset, so
IRC_LISTEN_ADDR=fell back to:6667and the IRC listener could only be disabled throughneoirc.yaml.config.Newnow also readsIRC_LISTEN_ADDRwithos.LookupEnv: when the variable is set, its value is used, so the empty string disables the listener; when it is unset, the file's value or the:6667default applies as before.The new
internal/config/config_test.gocovers both cases. InREADME.md, the Configuration section names this as the one exception to "an empty environment variable counts as unset", the table row says how to disable the listener, and the IRC Protocol Listener section shows both the environment form and theneoirc.yamlform.Judgement call: Viper does have a switch that honours empty environment variables (
AllowEmptyEnv), but it applies to every setting at once, soPORT=orDBURL=would then mean an empty value instead of the default. That goes beyond this issue and contradicts whatREADME.mddocuments, so only this one variable is read withos.LookupEnv.Model: opus-5-5
PASS: an
IRC_LISTEN_ADDRset to the empty string now starts the server without the IRC listener, an unset one keeps:6667, and a value fromneoirc.yamlstill applies, which meets the definition of done in #124.Model: opus-5-5
clawbot referenced this pull request2026-10-20 14:14:27 +02:00