Skip to content

Commit

Permalink
ci(project): fix renew script to load process.env
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious committed Mar 28, 2023
1 parent fc1f61f commit ca4912b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/renew.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function main() {
const rootEnv = loadEnv(path.join(__dirname, ".."));
const pkgEnv = loadEnv(process.cwd());

const secrets = loadSecrets(rootEnv, pkgEnv, process.env as dotenv.DotenvParseOutput);
const secrets = loadSecrets(rootEnv, pkgEnv);
if (!secrets) return;

const { AGORA_APPID, AGORA_CERTIFICATE } = secrets;
Expand All @@ -30,6 +30,10 @@ function main() {
}

export function loadSecrets(...variables: dotenv.DotenvParseOutput[]) {
const { AGORA_APPID, AGORA_CERTIFICATE } = process.env;
if (AGORA_APPID && AGORA_CERTIFICATE) {
return { AGORA_APPID, AGORA_CERTIFICATE };
}
for (let i = variables.length - 1; i >= 0; i--) {
const { AGORA_APPID, AGORA_CERTIFICATE } = variables[i];
if (AGORA_APPID && AGORA_CERTIFICATE) {
Expand Down

0 comments on commit ca4912b

Please sign in to comment.