P1: four config keys documented in README do not exist and now abort startup #61
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Verified against
mainat61f42e6.README.md:110-119presents these as "Key settings" and says "Seeconfig.example.ymlfor all options with defaults":access_control_allow_origin— CORS originupstream_fetch_timeout— timeout for origin requestsupstream_max_response_size— max origin response sizedownstream_timeout— client response timeoutNone of the four exist.
isKnownConfigKey(internal/config/config.go:217-227) permits only:debug,maintenance_mode,port,state_dir,sentry_dsn,db_url,metrics,signing_key,allowlist_hosts,allow_http,upstream_connections_per_host,env.Since #52/#53 landed strict unknown-key rejection, a user who follows the README does not get a silently-ignored key — the daemon refuses to start with
unknown config keys: .... That is the correct behavior for an unknown key (repo policy: set-but-unparseable config must abort), but it means our own documentation is a startup-breaking trap.The underlying values all exist, hardcoded:
[]string{"*"}atinternal/middleware/middleware.go:114DefaultFetchTimeout/DefaultMaxResponseSizeatinternal/httpfetcher/httpfetcher.go:22-23;internal/handlers/handlers.go:76-80currently overrides onlyAllowHTTPandMaxConnectionsPerHostHTTPWriteTimeoutatinternal/server/http.go:12access_control_allow_origindefaulting to*is itself worth a look while implementing — a wide-open CORS default on an image proxy is defensible but should be a deliberate, documented choice rather than an accident.Definition of done
Configstruct, toisKnownConfigKey, parsed with the strict getters (a set-but-invalid value must abort startup naming the key and the offending value, per repo policy — no silent fallback), and plumbed to the code that currently hardcodes each value.config.example.yml.config.example.ymlwith its default and a comment.internal/config/config_validation_internal_test.go.make checkgreen.Scope note
If this is more comfortable as four commits, split by key — but keep it one PR, since the shared work is the strict-getter plumbing.