mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 01:33:29 +00:00
Node install: persist gateway token in service env (#31122)
* Node daemon: persist gateway token env * changelog: add credits for node gateway token fix * changelog: credit byungsker for node token service fix --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
This commit is contained in:
@@ -364,6 +364,42 @@ describe("buildNodeServiceEnvironment", () => {
|
||||
expect(env.HOME).toBe("/home/user");
|
||||
});
|
||||
|
||||
it("passes through OPENCLAW_GATEWAY_TOKEN for node services", () => {
|
||||
const env = buildNodeServiceEnvironment({
|
||||
env: { HOME: "/home/user", OPENCLAW_GATEWAY_TOKEN: " node-token " },
|
||||
});
|
||||
expect(env.OPENCLAW_GATEWAY_TOKEN).toBe("node-token");
|
||||
});
|
||||
|
||||
it("maps legacy CLAWDBOT_GATEWAY_TOKEN to OPENCLAW_GATEWAY_TOKEN for node services", () => {
|
||||
const env = buildNodeServiceEnvironment({
|
||||
env: { HOME: "/home/user", CLAWDBOT_GATEWAY_TOKEN: " legacy-token " },
|
||||
});
|
||||
expect(env.OPENCLAW_GATEWAY_TOKEN).toBe("legacy-token");
|
||||
});
|
||||
|
||||
it("prefers OPENCLAW_GATEWAY_TOKEN over legacy CLAWDBOT_GATEWAY_TOKEN", () => {
|
||||
const env = buildNodeServiceEnvironment({
|
||||
env: {
|
||||
HOME: "/home/user",
|
||||
OPENCLAW_GATEWAY_TOKEN: "openclaw-token",
|
||||
CLAWDBOT_GATEWAY_TOKEN: "legacy-token",
|
||||
},
|
||||
});
|
||||
expect(env.OPENCLAW_GATEWAY_TOKEN).toBe("openclaw-token");
|
||||
});
|
||||
|
||||
it("omits OPENCLAW_GATEWAY_TOKEN when both token env vars are empty", () => {
|
||||
const env = buildNodeServiceEnvironment({
|
||||
env: {
|
||||
HOME: "/home/user",
|
||||
OPENCLAW_GATEWAY_TOKEN: " ",
|
||||
CLAWDBOT_GATEWAY_TOKEN: " ",
|
||||
},
|
||||
});
|
||||
expect(env.OPENCLAW_GATEWAY_TOKEN).toBeUndefined();
|
||||
});
|
||||
|
||||
it("forwards proxy environment variables for node services", () => {
|
||||
const env = buildNodeServiceEnvironment({
|
||||
env: {
|
||||
|
||||
Reference in New Issue
Block a user