You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 line
1.1KB

  1. #!/bin/bash
  2. set -e
  3. # build prefix
  4. CHATGPT_ON_WECHAT_PREFIX=${CHATGPT_ON_WECHAT_PREFIX:-""}
  5. # path to config.json
  6. CHATGPT_ON_WECHAT_CONFIG_PATH=${CHATGPT_ON_WECHAT_CONFIG_PATH:-""}
  7. # execution command line
  8. CHATGPT_ON_WECHAT_EXEC=${CHATGPT_ON_WECHAT_EXEC:-""}
  9. # Determine the environment and set the config file accordingly
  10. if [ "$environment" == "test" ]; then
  11. CHATGPT_ON_WECHAT_CONFIG_PATH=${CHATGPT_ON_WECHAT_CONFIG_PATH:-$CHATGPT_ON_WECHAT_PREFIX/config-test.json}
  12. elif [ "$environment" == "production" ]; then
  13. CHATGPT_ON_WECHAT_CONFIG_PATH=${CHATGPT_ON_WECHAT_CONFIG_PATH:-$CHATGPT_ON_WECHAT_PREFIX/config-production.json}
  14. else
  15. echo "Invalid environment specified. Please set environment to 'test' or 'prod'."
  16. exit 1
  17. fi
  18. # CHATGPT_ON_WECHAT_PREFIX is empty, use /app
  19. if [ "$CHATGPT_ON_WECHAT_PREFIX" == "" ]; then
  20. CHATGPT_ON_WECHAT_PREFIX=/app
  21. fi
  22. # CHATGPT_ON_WECHAT_EXEC is empty, use ‘python app.py’
  23. if [ "$CHATGPT_ON_WECHAT_EXEC" == "" ]; then
  24. CHATGPT_ON_WECHAT_EXEC="python app.py"
  25. fi
  26. # go to prefix dir
  27. cd $CHATGPT_ON_WECHAT_PREFIX
  28. # execute
  29. $CHATGPT_ON_WECHAT_EXEC