Commit 09a21d9
v0.4.5: tolerate missing [nginx] section and fail gracefully on bad config
The `nginx` field in `Config` was required, so a wolfproxy.toml without
an `[nginx]` section (as produced by wolfstack's restore button) caused
`toml::from_str` to fail with "missing field nginx", which the `.expect`
turned into a panic + SIGABRT + coredump in the journal. Other working
installs have always had `[nginx]` written by an earlier path; this only
surfaced once restore wrote a stripped-down config.
- Add `#[serde(default)]` to the `nginx` field — `NginxConfigSettings`
already has a `Default` impl returning `config_dir = "/etc/nginx"`.
- Replace `.expect` with a graceful `eprintln!` + `exit(1)` so a bad
config produces a readable journal line instead of a coredump.
Co-Authored-By: CodeWolf <paul@wolf.uk.com>
Co-Authored-By: Wolf Software Systems Ltd <paul@wolf.uk.com>1 parent 23a849d commit 09a21d9
2 files changed
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
137 | 138 | | |
138 | 139 | | |
139 | 140 | | |
| |||
300 | 301 | | |
301 | 302 | | |
302 | 303 | | |
303 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
304 | 312 | | |
305 | 313 | | |
306 | 314 | | |
| |||
0 commit comments