diff --git a/back/loaders/initFile.ts b/back/loaders/initFile.ts index 65e7ed46..3d9b7441 100644 --- a/back/loaders/initFile.ts +++ b/back/loaders/initFile.ts @@ -108,8 +108,6 @@ export default async () => { fs.writeFileSync(TaskAfterFile, fs.readFileSync(sampleTaskShellFile)); } - dotenv.config({ path: confFile }); - Logger.info('✌️ Init file down'); console.log('✌️ Init file down'); }; diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 5e706c91..c81b7d67 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -1,6 +1,7 @@ #!/bin/bash dir_shell=/ql/shell +. $dir_shell/env.sh . $dir_shell/share.sh link_shell diff --git a/shell/env.sh b/shell/env.sh new file mode 100644 index 00000000..4d7dcff7 --- /dev/null +++ b/shell/env.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +store_env_vars() { + initial_vars=($(compgen -A variable)) +} + +restore_env_vars() { + for key in $(compgen -A variable); do + if ! [[ " ${initial_vars[@]} " =~ " $key " ]]; then + unset "$key" + fi + done +} + +store_env_vars diff --git a/shell/share.sh b/shell/share.sh index f6b6a0b9..d1f57c40 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -19,7 +19,6 @@ dir_update_log=$dir_log/update ql_static_repo=$dir_repo/static ## 文件 -file_ecosystem_js=$dir_root/ecosystem.config.js file_config_sample=$dir_sample/config.sample.sh file_env=$dir_config/env.sh file_sharecode=$dir_config/sharecode.sh @@ -308,8 +307,9 @@ random_range() { reload_pm2() { cd $dir_root + restore_env_vars pm2 flush &>/dev/null - env ALL_PROXY= HTTP_PROXY= HTTPS_PROXY= all_proxy= http_proxy= https_proxy= pm2 startOrGracefulReload $file_ecosystem_js --update-env + pm2 startOrGracefulReload ecosystem.config.js } diff_time() { diff --git a/shell/update.sh b/shell/update.sh index 94224ea3..33f1b3b9 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash dir_shell=$QL_DIR/shell +. $dir_shell/env.sh . $dir_shell/share.sh . $dir_shell/api.sh