File size: 1,123 Bytes
8a3e0ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# entrypoint.sh
# 验证配置文件是否存在
if [ ! -f /app/config.toml ]; then
  echo "错误:未找到/app/config.toml配置文件"
  exit 1
fi
# 使用环境变量动态更新config.toml
sed -i "s/hostname = \".*\"/hostname = \"$HOSTNAME\"/" /app/config.toml
sed -i "s/ipv4 = \".*\"/ipv4 = \"$IPV4_ADDRESS\"/" /app/config.toml
sed -i "s|listeners = .*|listeners = [\"$LISTENERS\"]|" /app/config.toml
sed -i "s/rpc_portal = \".*\"/rpc_portal = \"$RPC_PORTAL\"/" /app/config.toml
sed -i "s/network_name = \".*\"/network_name = \"$NETWORK_NAME\"/" /app/config.toml
sed -i "s/network_secret = \".*\"/network_secret = \"$NETWORK_SECRET\"/" /app/config.toml
sed -i "s/no_tun = .*/no_tun = $NO_TUN/" /app/config.toml
# 验证supervisord配置文件
if [ ! -f /app/supervisor/supervisord.conf ]; then
  echo "错误:未找到/app/supervisor/supervisord.conf配置文件"
  exit 1
fi
# 验证ttyd端口
if [ -z "$TTYD_PORT" ]; then
  echo "警告:TTYD_PORT未设置,默认使用7860"
  TTYD_PORT=7860
fi
sed -i "s/-p [0-9]\+ /-p $TTYD_PORT /" /app/supervisor/supervisord.conf
# 启动supervisord
exec "$@"