You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b651d44
Browse filesBrowse the repository at this point in the historyBrowse files
fix(gateway): reject non-integer versions and allow an empty config dir
Require every layer to declare `[openshell] version` as an integer so a
malformed value cannot be hidden by a later drop-in that declares 2.
Report an error about a whole table that several files contribute to as an
error in the merged configuration, not in the last file that touches it.
Treat an empty `--config-dir` or `OPENSHELL_GATEWAY_CONFIG_DIR` as turning
drop-in configs off, including the implicit `gateway.d` directory.
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Copy file name to clipboardExpand all lines: crates/openshell-server/src/config_file.rs
+82-6Lines changed: 82 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1328,6 +1328,10 @@ pub enum ConfigFileError {
1328
1328
"unsupported gateway config version {version}; this build requires version {SCHEMA_VERSION}; migrate legacy fields to the version {SCHEMA_VERSION} schema"
1329
1329
)]
1330
1330
UnsupportedVersion{version:u32},
1331
+
#[error(
1332
+
"invalid gateway config version; `openshell.version` must be the integer {SCHEMA_VERSION}"
1333
+
)]
1334
+
InvalidVersion,
1331
1335
#[error(
1332
1336
"`{field}` is not allowed in the gateway config file — set the {env} env var or pass {cli} on the command line"
Copy file name to clipboardExpand all lines: deploy/man/openshell-gateway.8.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -165,7 +165,8 @@ configured in the TOML file passed with **--config**.
165
165
: Directory of **\*.toml** drop-in configs merged over the **--config**
166
166
file. Drop-in configs apply in lexical order and a later drop-in config wins. Each file must declare **version = 2**; a drop-in config may set only some keys of a table. Tables
167
167
merge key by key; scalars and arrays replace. Defaults to **gateway.d**
168
-
next to the config file when that directory exists.
168
+
next to the config file when that directory exists. An empty value turns
Copy file name to clipboardExpand all lines: docs/how-it-works/gateways/configuration.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,9 +58,9 @@ preflight and gateway startup.
58
58
59
59
## Drop-In Configs
60
60
61
-
The gateway merges `*.toml` drop-in configs from a directory over the base file. Use drop-in configs to customize a package-seeded `gateway.toml` without editing it. Set the directory with `--config-dir` or `OPENSHELL_GATEWAY_CONFIG_DIR`. When you do not set it, the gateway uses `gateway.d` next to the base file if that directory exists. An explicit directory must exist.
61
+
The gateway merges `*.toml` drop-in configs from a directory over the base file. Use drop-in configs to customize a package-seeded `gateway.toml` without editing it. Set the directory with `--config-dir` or `OPENSHELL_GATEWAY_CONFIG_DIR`. When you do not set it, the gateway uses `gateway.d` next to the base file if that directory exists. An explicit directory must exist. Set `--config-dir` or `OPENSHELL_GATEWAY_CONFIG_DIR` to an empty value to turn drop-in configs off.
62
62
63
-
Drop-in configs apply in lexical order by file name, and a later one wins. Each file must declare `[openshell] version = 2`. The merge works as follows:
63
+
Drop-in configs apply in lexical order by file name, and a later one wins. Each file must declare `[openshell] version = 2` as an integer. The merge works as follows:
64
64
65
65
- Tables merge key by key.
66
66
- Scalars and arrays replace the earlier value. An array in a drop-in config replaces the whole array.
0 commit comments