diff --git a/Dockerfile b/Dockerfile index 36d5d3b..d0feaf9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,5 +23,5 @@ RUN echo "[supervisord]" > /etc/supervisord.conf && \ echo "[program:napcat]" >> /etc/supervisord.conf && \ echo "command=COMMAND" >> /etc/supervisord.conf -ENTRYPOINT ["sh", "entrypoint.sh"] +ENTRYPOINT ["bash", "entrypoint.sh"] diff --git a/README.md b/README.md index 7932f4e..328a73d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ## 配置 -容器通过环境变量来配置,环境变量名称可以查看 [config.txt](./config.txt) +容器通过环境变量来配置,环境变量名称可以查看 [entrypoint](./entrypoint.sh)👈 具体参数可参考[官方文档](https://napneko.github.io/zh-CN/guide/getting-started) @@ -46,7 +46,7 @@ services: ## 反向 WS
-点我查看命令 +点我查看命令👈 ```shell docker run -d \ @@ -78,7 +78,7 @@ services: ## HTTP
-点我查看命令 +点我查看命令👈 ```shell docker run -d \ diff --git a/entrypoint.sh b/entrypoint.sh index b5c82fc..ca864ce 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,29 +2,19 @@ chech_quotes(){ local input="$1" - - if [[ $input =~ ^\".*\"$ ]]; then - echo "$input" + if [ "${input:0:1}" != '"' ] ; then + if [ "${input:0:1}" != '[' ] ; then + input="[\"$input\"]" + fi else - input=\""$input"\" - echo "$input" - fi -} - -chech_square_brackets(){ - local input="$1" - - if [[ $input =~ ^\[.*\]$ ]]; then - echo "$input" - else - input=[$input] - echo "$input" + input="[$input]" fi + echo $input } CONFIG_PATH=napcat/config/onebot11_$ACCOUNT.json # 容器首次启动时执行 -if [ ! -f "a$CONFIG_PATH" ]; then +if [ ! -f "$CONFIG_PATH" ]; then if [ "$WEBUI_TOKEN" ]; then echo "{\"port\": 6099,\"token\": \"$WEBUI_TOKEN\",\"loginRate\": 3}" > napcat/config/webui.json fi @@ -49,8 +39,8 @@ if [ ! -f "a$CONFIG_PATH" ]; then : ${HTTP_HEART_ENABLE:='false'} : ${MUSIC_SIGN_URL:=''} : ${HTTP_SECRET:=''} - HTTP_URLS=$(chech_square_brackets $(chech_quotes $HTTP_URLS) - WS_URLS=$(chech_square_brackets $(chech_quotes $WS_URLS) + HTTP_URLS=$(chech_quotes $HTTP_URLS) + WS_URLS=$(chech_quotes $WS_URLS) cat < $CONFIG_PATH { "httpHost": "$HTTP_HOST",