Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

config: treat a top-level "//" key as a comment, not an unknown field (#505)

Regan Belle5bc873fe9ec
diff --git a/cli/package-lock.json b/cli/package-lock.json
index 471eabca4..9db291b19 100644
--- a/cli/package-lock.json
+++ b/cli/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@yc-software/qm",
- "version": "0.1.7",
+ "version": "0.1.8",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@yc-software/qm",
- "version": "0.1.7",
+ "version": "0.1.8",
"license": "MIT",
"bin": {
"qm": "dist/bin/qm.js"
diff --git a/cli/package.json b/cli/package.json
index 588271b14..2bb3a343b 100644
--- a/cli/package.json
+++ b/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@yc-software/qm",
- "version": "0.1.7",
+ "version": "0.1.8",
"license": "MIT",
"description": "Control-plane CLI for portable QM deployments on Docker, Fly, and AWS.",
"type": "module",
diff --git a/cli/src/config.ts b/cli/src/config.ts
index e5fc6ecf4..56cc5c3b8 100644
--- a/cli/src/config.ts
+++ b/cli/src/config.ts
@@ -509,7 +509,7 @@ function validate(raw: unknown, path: string): QmConfig {
const o = raw;
for (const key of Object.keys(o)) {
- if (!VALID_TOP_LEVEL_KEYS.has(key)) {
+ if (key !== "//" && !VALID_TOP_LEVEL_KEYS.has(key)) {
throw new CliError(`${path}: unknown top-level field ${JSON.stringify(key)}`);
}
}
diff --git a/cli/test/config.test.ts b/cli/test/config.test.ts
index 8aed014ef..f83415928 100644
--- a/cli/test/config.test.ts
+++ b/cli/test/config.test.ts
@@ -68,6 +68,9 @@ test("required fields: orgId, target, services (must include core), valid servic
withConfig({ org_id: "acme" }, ({ path }) =>
assert.throws(() => loadConfigAt(path), /unknown top-level field "org_id"/),
);
+ withConfig({ "//": "comment-key convention for plain-JSON configs" }, ({ path }) => {
+ assert.ok(loadConfigAt(path).config);
+ });
});
test("apiUrl must be an http(s) origin URL; the trailing slash is stripped", () => {