Skip to content

Commit 231113e

Browse files
committed
Expand the env vars in the environment URL
1 parent 3eaea7d commit 231113e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/wrapper/Pipedream.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ export interface BackendOpts {
1010
projectId: string;
1111
}
1212

13+
function expandEnvVars(template: string) {
14+
return template.replace(/\$\{(\w+)\}/g, (_, key) => process.env[key] ?? "");
15+
}
16+
1317
export class Pipedream extends PipedreamClient {
1418
public constructor(opts: BackendOpts) {
1519
const {
1620
clientId = process.env.PIPEDREAM_CLIENT_ID,
1721
clientSecret = process.env.PIPEDREAM_CLIENT_SECRET,
18-
environment = environments.PipedreamEnvironment.Prod,
22+
environment: rawEnvironment = environments.PipedreamEnvironment.Prod,
1923
projectEnvironment = process.env.PIPEDREAM_PROJECT_ENVIRONMENT ?? "production",
2024
projectId = process.env.PIPEDREAM_PROJECT_ID,
2125
} = opts;
@@ -29,6 +33,8 @@ export class Pipedream extends PipedreamClient {
2933
throw new Error("Project ID is required");
3034
}
3135

36+
const environment = expandEnvVars(rawEnvironment.toString());
37+
3238
super({
3339
clientId,
3440
clientSecret,

0 commit comments

Comments
 (0)