|
- #!/bin/bash
- set -e
-
- # build prefix
- CHATGPT_ON_WECHAT_PREFIX=${CHATGPT_ON_WECHAT_PREFIX:-""}
- # path to config.json
- CHATGPT_ON_WECHAT_CONFIG_PATH=${CHATGPT_ON_WECHAT_CONFIG_PATH:-""}
- # execution command line
- CHATGPT_ON_WECHAT_EXEC=${CHATGPT_ON_WECHAT_EXEC:-""}
-
- # Determine the environment and set the config file accordingly
- if [ "$environment" == "test" ]; then
- CHATGPT_ON_WECHAT_CONFIG_PATH=${CHATGPT_ON_WECHAT_CONFIG_PATH:-$CHATGPT_ON_WECHAT_PREFIX/config-test.json}
- elif [ "$environment" == "production" ]; then
- CHATGPT_ON_WECHAT_CONFIG_PATH=${CHATGPT_ON_WECHAT_CONFIG_PATH:-$CHATGPT_ON_WECHAT_PREFIX/config-production.json}
- else
- echo "Invalid environment specified. Please set environment to 'test' or 'prod'."
- exit 1
- fi
-
- # CHATGPT_ON_WECHAT_PREFIX is empty, use /app
- if [ "$CHATGPT_ON_WECHAT_PREFIX" == "" ]; then
- CHATGPT_ON_WECHAT_PREFIX=/app
- fi
-
- # CHATGPT_ON_WECHAT_EXEC is empty, use ‘python app.py’
- if [ "$CHATGPT_ON_WECHAT_EXEC" == "" ]; then
- CHATGPT_ON_WECHAT_EXEC="python app.py"
- fi
-
- # go to prefix dir
- cd $CHATGPT_ON_WECHAT_PREFIX
- # execute
- $CHATGPT_ON_WECHAT_EXEC
|