Skip to content

Commit 696fa36

Browse files
committed
feat(gateway): merge drop-in configs over the base file
Load `*.toml` drop-in configs from a directory and merge them over the base config in lexical order, so operators and packages can customize a gateway without editing the base file. Select the directory with `--config-dir` or `OPENSHELL_GATEWAY_CONFIG_DIR`, or let the gateway use `gateway.d` beside the base file. An empty value turns drop-in configs off. `--config` and `--config-dir` compose. Tables merge key by key; scalars and arrays replace; a drop-in cannot unset a key. Every file must declare `[openshell] version = 2` as an integer, but a drop-in may set only some keys of a table. The merged result is validated once. An error names the file that sets the offending key, with its line and column for a single file and its key path for several. Errors that no single key explains, such as a missing required key or a rule over a table that several files set, name the merged configuration and its files. Unknown keys are rejected. Follow a drop-in symlink only when it resolves inside the drop-in directory, which covers Kubernetes ConfigMap mounts, and keep the base file strict. Treat a `gateway.d` with no drop-in configs and no base file as no configuration. `load` and `preflight` use the same loader, `config preflight` lists the files it merged, and the gateway logs them at startup. Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent e1920f0 commit 696fa36

10 files changed

Lines changed: 1475 additions & 122 deletions

File tree

‎Cargo.lock‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/openshell-server/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ bytes = { workspace = true }
9292
pin-project-lite = { workspace = true }
9393
serde = { workspace = true }
9494
serde_json = { workspace = true }
95+
serde_path_to_error = { workspace = true }
9596
toml = { workspace = true }
9697
tokio-stream = { workspace = true }
9798
sqlx = { workspace = true }

0 commit comments

Comments
 (0)