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.

entrypoint.sh 1.2KB

2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
123456789101112131415161718192021222324252627282930313233343536
  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. elif [ "$environment" == "dev" ]; then
  15. CHATGPT_ON_WECHAT_CONFIG_PATH=${CHATGPT_ON_WECHAT_CONFIG_PATH:-$CHATGPT_ON_WECHAT_PREFIX/config-dev.json}
  16. else
  17. echo "Invalid environment specified. Please set environment to 'test' or 'prod' or 'dev'."
  18. exit 1
  19. fi
  20. # CHATGPT_ON_WECHAT_PREFIX is empty, use /app
  21. if [ "$CHATGPT_ON_WECHAT_PREFIX" == "" ]; then
  22. CHATGPT_ON_WECHAT_PREFIX=/app
  23. fi
  24. # CHATGPT_ON_WECHAT_EXEC is empty, use ‘python app.py’
  25. if [ "$CHATGPT_ON_WECHAT_EXEC" == "" ]; then
  26. CHATGPT_ON_WECHAT_EXEC="python app.py"
  27. fi
  28. # go to prefix dir
  29. cd $CHATGPT_ON_WECHAT_PREFIX
  30. # execute
  31. $CHATGPT_ON_WECHAT_EXEC