detached 1f28591

fix(config): enable nested env vars with SetEnvKeyReplacer

Add strings.NewReplacer(".", "_") to viper config so environment
variables like GORDON_REGISTRY_AUTH_ENABLED correctly map to nested
config keys like registry_auth.enabled.

Restores env var documentation in wiki that was incorrectly removed.
commit
1f2859183b909037a0d1705cddbf33fa59c351d9
author
brice · · 2026-01-16 06:33 UTC
parent
eb6fc8c
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +9 -12
M internal/app/run.go +2 -0
@@ -11,6 +11,7 @@ import (
1111 "os"
1212 "os/signal"
1313 "path/filepath"
14+ "strings"
1415 "syscall"
1516 "time"
1617
@@ -1072,6 +1073,7 @@ func loadConfig(v *viper.Viper, configPath string) error {
10721073 }
10731074
10741075 v.SetEnvPrefix("GORDON")
1076+ v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
10751077 v.AutomaticEnv()
10761078
10771079 return nil
@@ -11,6 +11,7 @@ import (
11 "os"11 "os"
12 "os/signal"12 "os/signal"
13 "path/filepath"13 "path/filepath"
14+ "strings"
14 "syscall"15 "syscall"
15 "time"16 "time"
16 17
@@ -1072,6 +1073,7 @@ func loadConfig(v *viper.Viper, configPath string) error {
1072 }1073 }
1073 1074
1074 v.SetEnvPrefix("GORDON")1075 v.SetEnvPrefix("GORDON")
1076+ v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
1075 v.AutomaticEnv()1077 v.AutomaticEnv()
1076 1078
1077 return nil1079 return nil
M wiki/guides/running-in-container.md +7 -12
@@ -213,23 +213,18 @@ systemctl --user enable --now gordon
213213
214214 ### Environment Variables
215215
216-Some configuration options can be set via environment variables with `GORDON_` prefix.
217-
218-> **Note**: Environment variables work best for simple options. For nested configuration like `registry_auth`, use a mounted config file instead.
216+All configuration options can be set via environment variables with `GORDON_` prefix:
219217
220218 | Variable | Description | Example |
221219 |----------|-------------|---------|
220+| `GORDON_SERVER_PORT` | Proxy port | `8080` |
221+| `GORDON_SERVER_REGISTRY_PORT` | Registry port | `5000` |
222222 | `GORDON_SERVER_REGISTRY_DOMAIN` | Registry domain (required) | `registry.mydomain.com` |
223+| `GORDON_SERVER_DATA_DIR` | Data directory | `/data` |
223224 | `GORDON_LOGGING_LEVEL` | Log level | `debug`, `info`, `warn`, `error` |
224-
225-For registry authentication and other nested options, use a config file:
226-
227-```toml
228-[registry_auth]
229-enabled = true
230-username = "admin"
231-password = "secret"
232-```
225+| `GORDON_REGISTRY_AUTH_ENABLED` | Enable registry auth | `true` |
226+| `GORDON_REGISTRY_AUTH_USERNAME` | Registry username | `admin` |
227+| `GORDON_REGISTRY_AUTH_PASSWORD` | Registry password | `secret` |
233228
234229 ## Security Considerations
235230
@@ -213,23 +213,18 @@ systemctl --user enable --now gordon
213 213
214 ### Environment Variables214 ### Environment Variables
215 215
216-Some configuration options can be set via environment variables with `GORDON_` prefix.216+All configuration options can be set via environment variables with `GORDON_` prefix:
217-
218-> **Note**: Environment variables work best for simple options. For nested configuration like `registry_auth`, use a mounted config file instead.
219 217
220 | Variable | Description | Example |218 | Variable | Description | Example |
221 |----------|-------------|---------|219 |----------|-------------|---------|
220+| `GORDON_SERVER_PORT` | Proxy port | `8080` |
221+| `GORDON_SERVER_REGISTRY_PORT` | Registry port | `5000` |
222 | `GORDON_SERVER_REGISTRY_DOMAIN` | Registry domain (required) | `registry.mydomain.com` |222 | `GORDON_SERVER_REGISTRY_DOMAIN` | Registry domain (required) | `registry.mydomain.com` |
223+| `GORDON_SERVER_DATA_DIR` | Data directory | `/data` |
223 | `GORDON_LOGGING_LEVEL` | Log level | `debug`, `info`, `warn`, `error` |224 | `GORDON_LOGGING_LEVEL` | Log level | `debug`, `info`, `warn`, `error` |
224-225+| `GORDON_REGISTRY_AUTH_ENABLED` | Enable registry auth | `true` |
225-For registry authentication and other nested options, use a config file:226+| `GORDON_REGISTRY_AUTH_USERNAME` | Registry username | `admin` |
226-227+| `GORDON_REGISTRY_AUTH_PASSWORD` | Registry password | `secret` |
227-```toml
228-[registry_auth]
229-enabled = true
230-username = "admin"
231-password = "secret"
232-```
233 228
234 ## Security Considerations229 ## Security Considerations
235 230

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close