mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 14:26:07 +08:00
修复服务启动时环境变量污染
This commit is contained in:
parent
046239404f
commit
4938635ef4
|
@ -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');
|
||||
};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
dir_shell=/ql/shell
|
||||
. $dir_shell/env.sh
|
||||
. $dir_shell/share.sh
|
||||
link_shell
|
||||
|
||||
|
|
15
shell/env.sh
Normal file
15
shell/env.sh
Normal file
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user