Skip to content

Commit 99a41ad

Browse files
authored
broker: accept org IDs in deprecated workspace alias schema (#200)
1 parent 3ae675f commit 99a41ad

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

.env.schema

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,12 @@ GATEWAY_BROKER_ORG_ID=
145145
# @sensitive=false @type=string
146146
SLACK_BROKER_ORG_ID=
147147

148-
# Deprecated workspace/team ID aliases (still accepted for migration)
149-
# @sensitive=false @type=string(startsWith=T)
148+
# Deprecated workspace/team ID aliases (still accepted for migration).
149+
# May contain either legacy Slack workspace IDs (T...) or broker org IDs (org_...).
150+
# @sensitive=false @type=string
150151
GATEWAY_BROKER_WORKSPACE_ID=
151152

152-
# @sensitive=false @type=string(startsWith=T)
153+
# @sensitive=false @type=string
153154
SLACK_BROKER_WORKSPACE_ID=
154155

155156
# Gateway server X25519 private key (base64, preferred)

bin/broker-register.test.mjs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import fs from "node:fs";
44
import os from "node:os";
55
import path from "node:path";
66
import { createServer } from "node:http";
7-
import { pathToFileURL } from "node:url";
7+
import { fileURLToPath, pathToFileURL } from "node:url";
88
import {
99
parseArgs,
1010
normalizeBrokerUrl,
@@ -266,6 +266,19 @@ test("runRegistration integration path succeeds against live local HTTP server",
266266
}
267267
});
268268

269+
test("env schema accepts org IDs for deprecated workspace aliases", () => {
270+
const schemaPath = fileURLToPath(new URL("../.env.schema", import.meta.url));
271+
const lines = fs.readFileSync(schemaPath, "utf8").split(/\r?\n/);
272+
273+
const gatewayWorkspaceIndex = lines.findIndex((line) => line.startsWith("GATEWAY_BROKER_WORKSPACE_ID="));
274+
assert.notEqual(gatewayWorkspaceIndex, -1, "GATEWAY_BROKER_WORKSPACE_ID missing from .env.schema");
275+
assert.equal(lines[gatewayWorkspaceIndex - 1].trim(), "# @sensitive=false @type=string");
276+
277+
const slackWorkspaceIndex = lines.findIndex((line) => line.startsWith("SLACK_BROKER_WORKSPACE_ID="));
278+
assert.notEqual(slackWorkspaceIndex, -1, "SLACK_BROKER_WORKSPACE_ID missing from .env.schema");
279+
assert.equal(lines[slackWorkspaceIndex - 1].trim(), "# @sensitive=false @type=string");
280+
});
281+
269282
test("runRegistration does not write SLACK_BOT_TOKEN even when broker returns encrypted_bot_token", async () => {
270283
const fetchImpl = async (url) => {
271284
if (String(url).endsWith("/api/broker-pubkey")) {

0 commit comments

Comments
 (0)