From ca4912b92e7f58a466b9b975e098d1b866751da2 Mon Sep 17 00:00:00 2001 From: hyrious Date: Tue, 28 Mar 2023 18:55:32 +0800 Subject: [PATCH] ci(project): fix renew script to load process.env --- scripts/renew.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/renew.ts b/scripts/renew.ts index 38b97f10..dbec095d 100644 --- a/scripts/renew.ts +++ b/scripts/renew.ts @@ -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; @@ -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) {