mirror of
https://github.com/CloudNebulaProject/barycenter.git
synced 2026-04-10 13:10:42 +00:00
fix: Add prefix_separator to config env override
The config-rs crate uses '_' as the default prefix separator, so
BARYCENTER__DATABASE__URL was parsed as _database.url instead of
database.url. Adding prefix_separator("__") ensures double-underscore
env vars are correctly mapped to nested config keys.
Also makes the database section in the Helm ConfigMap conditional so
it can be omitted when the URL is provided via environment variable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8d835e240b
commit
204c2958a8
2 changed files with 7 additions and 2 deletions
|
|
@ -13,8 +13,10 @@ data:
|
||||||
public_base_url = {{ .Values.config.server.publicBaseUrl | quote }}
|
public_base_url = {{ .Values.config.server.publicBaseUrl | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if .Values.config.database.url }}
|
||||||
[database]
|
[database]
|
||||||
url = {{ .Values.config.database.url | quote }}
|
url = {{ .Values.config.database.url | quote }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
[keys]
|
[keys]
|
||||||
jwks_path = {{ .Values.config.keys.jwksPath | quote }}
|
jwks_path = {{ .Values.config.keys.jwksPath | quote }}
|
||||||
|
|
|
||||||
|
|
@ -145,8 +145,11 @@ impl Settings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Environment overrides: BARYCENTER__SERVER__PORT=9090, etc.
|
// Environment overrides: BARYCENTER__SERVER__PORT=9090, etc.
|
||||||
builder =
|
builder = builder.add_source(
|
||||||
builder.add_source(config::Environment::with_prefix("BARYCENTER").separator("__"));
|
config::Environment::with_prefix("BARYCENTER")
|
||||||
|
.prefix_separator("__")
|
||||||
|
.separator("__"),
|
||||||
|
);
|
||||||
|
|
||||||
let cfg = builder.build().into_diagnostic()?;
|
let cfg = builder.build().into_diagnostic()?;
|
||||||
let mut s: Settings = cfg.try_deserialize().into_diagnostic()?;
|
let mut s: Settings = cfg.try_deserialize().into_diagnostic()?;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue