mirror of
https://github.com/NapNeko/NapCat-Docker.git
synced 2025-12-20 23:22:08 +08:00
chore: use bash & fix destructive configuration
This commit is contained in:
parent
cf263559d6
commit
5c20192c19
@ -23,5 +23,5 @@ RUN echo "[supervisord]" > /etc/supervisord.conf && \
|
|||||||
echo "[program:napcat]" >> /etc/supervisord.conf && \
|
echo "[program:napcat]" >> /etc/supervisord.conf && \
|
||||||
echo "command=COMMAND" >> /etc/supervisord.conf
|
echo "command=COMMAND" >> /etc/supervisord.conf
|
||||||
|
|
||||||
ENTRYPOINT ["sh", "entrypoint.sh"]
|
ENTRYPOINT ["bash", "entrypoint.sh"]
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
## 配置
|
## 配置
|
||||||
|
|
||||||
容器通过环境变量来配置,环境变量名称可以查看 [config.txt](./config.txt)
|
容器通过环境变量来配置,环境变量名称可以查看 [entrypoint](./entrypoint.sh)👈
|
||||||
|
|
||||||
具体参数可参考[官方文档](https://napneko.github.io/zh-CN/guide/getting-started)
|
具体参数可参考[官方文档](https://napneko.github.io/zh-CN/guide/getting-started)
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ services:
|
|||||||
|
|
||||||
## 反向 WS
|
## 反向 WS
|
||||||
<details>
|
<details>
|
||||||
<summary>点我查看命令</summary>
|
<summary>点我查看命令👈</summary>
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
docker run -d \
|
docker run -d \
|
||||||
@ -78,7 +78,7 @@ services:
|
|||||||
|
|
||||||
## HTTP
|
## HTTP
|
||||||
<details>
|
<details>
|
||||||
<summary>点我查看命令</summary>
|
<summary>点我查看命令👈</summary>
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
docker run -d \
|
docker run -d \
|
||||||
|
|||||||
@ -2,29 +2,19 @@
|
|||||||
|
|
||||||
chech_quotes(){
|
chech_quotes(){
|
||||||
local input="$1"
|
local input="$1"
|
||||||
|
if [ "${input:0:1}" != '"' ] ; then
|
||||||
if [[ $input =~ ^\".*\"$ ]]; then
|
if [ "${input:0:1}" != '[' ] ; then
|
||||||
echo "$input"
|
input="[\"$input\"]"
|
||||||
else
|
|
||||||
input=\""$input"\"
|
|
||||||
echo "$input"
|
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
chech_square_brackets(){
|
|
||||||
local input="$1"
|
|
||||||
|
|
||||||
if [[ $input =~ ^\[.*\]$ ]]; then
|
|
||||||
echo "$input"
|
|
||||||
else
|
else
|
||||||
input=[$input]
|
input="[$input]"
|
||||||
echo "$input"
|
|
||||||
fi
|
fi
|
||||||
|
echo $input
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG_PATH=napcat/config/onebot11_$ACCOUNT.json
|
CONFIG_PATH=napcat/config/onebot11_$ACCOUNT.json
|
||||||
# 容器首次启动时执行
|
# 容器首次启动时执行
|
||||||
if [ ! -f "a$CONFIG_PATH" ]; then
|
if [ ! -f "$CONFIG_PATH" ]; then
|
||||||
if [ "$WEBUI_TOKEN" ]; then
|
if [ "$WEBUI_TOKEN" ]; then
|
||||||
echo "{\"port\": 6099,\"token\": \"$WEBUI_TOKEN\",\"loginRate\": 3}" > napcat/config/webui.json
|
echo "{\"port\": 6099,\"token\": \"$WEBUI_TOKEN\",\"loginRate\": 3}" > napcat/config/webui.json
|
||||||
fi
|
fi
|
||||||
@ -49,8 +39,8 @@ if [ ! -f "a$CONFIG_PATH" ]; then
|
|||||||
: ${HTTP_HEART_ENABLE:='false'}
|
: ${HTTP_HEART_ENABLE:='false'}
|
||||||
: ${MUSIC_SIGN_URL:=''}
|
: ${MUSIC_SIGN_URL:=''}
|
||||||
: ${HTTP_SECRET:=''}
|
: ${HTTP_SECRET:=''}
|
||||||
HTTP_URLS=$(chech_square_brackets $(chech_quotes $HTTP_URLS)
|
HTTP_URLS=$(chech_quotes $HTTP_URLS)
|
||||||
WS_URLS=$(chech_square_brackets $(chech_quotes $WS_URLS)
|
WS_URLS=$(chech_quotes $WS_URLS)
|
||||||
cat <<EOF > $CONFIG_PATH
|
cat <<EOF > $CONFIG_PATH
|
||||||
{
|
{
|
||||||
"httpHost": "$HTTP_HOST",
|
"httpHost": "$HTTP_HOST",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user