mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
修复服务启动时环境变量污染
This commit is contained in:
@@ -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
|
||||
+2
-2
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user