Skip to content

Commit bd73aa9

Browse files
committed
env template
1 parent 107921e commit bd73aa9

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

packages/service/core/workflow/dispatch/tools/codeSandbox.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ type RunCodeResponse = DispatchNodeResultType<
2222
}
2323
>;
2424

25+
const token = process.env.SANDBOX_TOKEN;
26+
2527
export const runCode = async ({
2628
codeType,
2729
code,
@@ -48,10 +50,18 @@ export const runCode = async ({
4850
codeReturn: Record<string, any>;
4951
log: string;
5052
};
51-
}>(url, {
52-
code,
53-
variables
54-
});
53+
}>(
54+
url,
55+
{
56+
code,
57+
variables
58+
},
59+
{
60+
headers: {
61+
Authorization: token ? `Bearer ${token}` : undefined
62+
}
63+
}
64+
);
5565

5666
if (!runResult.success) {
5767
return Promise.reject('Run code failed');

projects/app/.env.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ HIDE_CHAT_COPYRIGHT_SETTING=
2424
# Plugin
2525
PLUGIN_BASE_URL=http://localhost:3003
2626
PLUGIN_TOKEN=token
27-
# code sandbox url
27+
# Code sandbox server
2828
SANDBOX_URL=http://localhost:3002
29+
SANDBOX_TOKEN=
2930
# ai proxy api
3031
AIPROXY_API_ENDPOINT=https://localhost:3010
3132
AIPROXY_API_TOKEN=aiproxy

0 commit comments

Comments
 (0)