Skip to content

Commit

Permalink
Update: docker-entrypoint script
Browse files Browse the repository at this point in the history
1. change Surgio program folder
2. remove default Provider and Template if config is provided
  • Loading branch information
Kare-Udon committed Feb 14, 2023
1 parent cfa04c9 commit 2f302c4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ ln -sf /usr/share/zoneinfo/${TZ:-"Asia/Shanghai"} /etc/localtime
echo ${TZ:-"Asia/Shanghai"} > /etc/timezone

# create gateway
\cp -rf /gateway.js /my-rule-store/
\cp -rf /gateway.js /surgio/

# custom config
config_dir="/var/config"
if [ -d $config_dir ]&&[ "$(ls -A $config_dir)" ];then
\cp -rf /var/config/* /my-rule-store/
rm -rf /surgio/provider/* /surgio/template/*
\cp -rf /var/config/* /surgio/
fi

if [ -f /my-rule-store/package.json ];then
sed -i '/"scripts": {/a "generage": "surgio generate",' /my-rule-store/package.json
if [ -f /surgio/package.json ];then
sed -i '/"scripts": {/a "generage": "surgio generate",' /surgio/package.json
fi

# generate rules and run gateway
cd /my-rule-store
cd /surgio
npm run generage && node gateway.js

0 comments on commit 2f302c4

Please sign in to comment.