start.sh 733 B

1234567891011121314151617181920212223
  1. #/bin/sh
  2. if [ ! -f /usr/share/nginx/html/conf/config.js ]; then
  3. cp /app/public/conf/config.js /usr/share/nginx/html/conf
  4. fi
  5. if [ $API_URL ]; then
  6. echo "当前 API 地址为: $API_URL"
  7. sed -i "s#http://127.0.0.1:25500#$API_URL#g" /usr/share/nginx/html/conf/config.js
  8. else
  9. echo "当前为默认本地 API 地址: http://127.0.0.1:25500"
  10. echo "如需修改请在容器启动时使用 -e API_URL='https://sub.ops.ci' 传递环境变量"
  11. fi
  12. if [ $SHORT_URL ]; then
  13. echo "当前短链接地址为: $SHORT_URL"
  14. sed -i "s#https://s.ops.ci#$SHORT_URL#g" /usr/share/nginx/html/conf/config.js
  15. fi
  16. if [ $SITE_NAME ]; then
  17. sed -i "s#Subconverter Web#$SITE_NAME#g" /usr/share/nginx/html/conf/config.js
  18. fi
  19. nginx -g "daemon off;"