Skip to content

Commit

Permalink
・環境変数をsystemctlで読み込めるように変更
Browse files Browse the repository at this point in the history
  • Loading branch information
resca committed Mar 1, 2024
1 parent 29b415c commit f130a8d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 12 additions & 0 deletions changelist
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ if [ $# -lt 2 ] && [ $ERR -eq 0 ]; then
ERR=1
fi

if [ ! -d /etc/sysconfig ] && [ $ERR -eq 0 ]; then
sudo mkdir /etc/sysconfig
if [[ "$2" == *.service* ]]; then
sudo sed -i '/TimeoutSec=60/i EnvironmentFile=\/etc\/sysconfig\/safelist' /etc/systemd/system/$2
else
sudo sed -i '/TimeoutSec=60/i EnvironmentFile=\/etc\/sysconfig\/safelist' /etc/systemd/system/$2.service
fi
fi

while [ $# -gt 0 ] && [ $ERR -eq 0 ]
do
Expand All @@ -59,8 +67,10 @@ do
echo "[INFO] Changing list."
export SAFE_LIST='true'
sudo echo "export SAFE_LIST='true'" | sudo tee /etc/profile.d/changelist.sh
sudo echo "SAFE_LIST='true'" | sudo tee /etc/sysconfig/safelist
python3 changelist.py
echo "[INFO] $2 will be restarting..."
#sudo systemctl daemon-reload
#sudo systemctl start $2
echo "[INFO] Done."
;;
Expand All @@ -71,8 +81,10 @@ do
echo "[INFO] Changing list."
export SAFE_LIST='false'
sudo echo "export SAFE_LIST='false'" | sudo tee /etc/profile.d/changelist.sh
sudo echo "SAFE_LIST='false'" | sudo tee /etc/sysconfig/safelist
python3 changelist.py
echo "[INFO] $2 will be restarting..."
#sudo systemctl daemon-reload
#sudo systemctl start $2
echo "[INFO] Done."
;;
Expand Down
6 changes: 0 additions & 6 deletions packages/backend/src/postgres.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@ class MyCustomLogger implements Logger {

@bindThis
public logQuery(query: string, parameters?: any[]) {
console.log(`SAFE_LIST= ${process.env.SAFE_LIST}`);
if(process.env.SAFE_LIST=='true')
console.log(`SAFE_LIST == true`);
if(process.env.SAFE_LIST==='true')
console.log(`SAFE_LIST === true`);

sqlLogger.info(this.highlight(query).substring(0, 100));
}

Expand Down

0 comments on commit f130a8d

Please sign in to comment.