mirror of
https://github.com/NapNeko/NapCat-Docker.git
synced 2025-12-19 06:30:12 +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 "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)
|
||||
|
||||
@ -46,7 +46,7 @@ services:
|
||||
|
||||
## 反向 WS
|
||||
<details>
|
||||
<summary>点我查看命令</summary>
|
||||
<summary>点我查看命令👈</summary>
|
||||
|
||||
```shell
|
||||
docker run -d \
|
||||
@ -78,7 +78,7 @@ services:
|
||||
|
||||
## HTTP
|
||||
<details>
|
||||
<summary>点我查看命令</summary>
|
||||
<summary>点我查看命令👈</summary>
|
||||
|
||||
```shell
|
||||
docker run -d \
|
||||
|
||||
@ -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 <<EOF > $CONFIG_PATH
|
||||
{
|
||||
"httpHost": "$HTTP_HOST",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user