refactor: move whatsapp allowFrom config
This commit is contained in:
@@ -163,6 +163,7 @@ vi.mock("../config/config.js", () => {
|
||||
valid: true,
|
||||
config: {},
|
||||
issues: [],
|
||||
legacyIssues: [],
|
||||
};
|
||||
}
|
||||
try {
|
||||
@@ -176,6 +177,7 @@ vi.mock("../config/config.js", () => {
|
||||
valid: true,
|
||||
config: parsed,
|
||||
issues: [],
|
||||
legacyIssues: [],
|
||||
};
|
||||
} catch (err) {
|
||||
return {
|
||||
@@ -186,6 +188,7 @@ vi.mock("../config/config.js", () => {
|
||||
valid: false,
|
||||
config: {},
|
||||
issues: [{ path: "", message: `read failed: ${String(err)}` }],
|
||||
legacyIssues: [],
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -206,7 +209,7 @@ vi.mock("../config/config.js", () => {
|
||||
model: "anthropic/claude-opus-4-5",
|
||||
workspace: path.join(os.tmpdir(), "clawd-gateway-test"),
|
||||
},
|
||||
routing: {
|
||||
whatsapp: {
|
||||
allowFrom: testAllowFrom,
|
||||
},
|
||||
session: { mainKey: "main", store: testSessionStorePath },
|
||||
|
||||
@@ -6641,7 +6641,7 @@ export async function startGatewayServer(
|
||||
if (explicit) return resolvedTo;
|
||||
|
||||
const cfg = cfgForAgent ?? loadConfig();
|
||||
const rawAllow = cfg.routing?.allowFrom ?? [];
|
||||
const rawAllow = cfg.whatsapp?.allowFrom ?? [];
|
||||
if (rawAllow.includes("*")) return resolvedTo;
|
||||
const allowFrom = rawAllow
|
||||
.map((val) => normalizeE164(val))
|
||||
|
||||
Reference in New Issue
Block a user