2
0

feat: docker timezone follow host timezone

This commit is contained in:
zhangsz
2025-02-14 00:18:57 +11:00
parent 8955563f37
commit 40f63ffe22
4 changed files with 32 additions and 5 deletions

View File

@@ -81,14 +81,30 @@ case "$1" in
done
done
if [ ! -z "${new_ip}" ]; then
# 使用sed命令替换IP地址
# 替换.env文件
sed "s/WFC_SERVER_IP=.*/WFC_SERVER_IP=${new_ip}/" ${org_env_file} > $tmp_env_file
# sed -i "s/GATEWAY_ADDR=.*/GATEWAY_ADDR=${new_ip}:8080/" $tmp_env_file
mv $tmp_env_file $org_env_file
fi
# Check system timezone
if [ -f /etc/timezone ]; then
TIMEZONE=$(cat /etc/timezone)
elif [ -f /etc/localtime ]; then
TIMEZONE=$(readlink /etc/localtime | sed 's|.*/zoneinfo/||')
else
TIMEZONE="UTC"
fi
if grep -q "TZ=" ${org_env_file}; then
sed "s|TZ=.*|TZ=${TIMEZONE}|" ${org_env_file} > $tmp_env_file
else
echo "TZ=${TIMEZONE}" >> ${org_env_file}
fi
mv $tmp_env_file $org_env_file
# replace nginx.conf gateway server ip and port
while IFS= read -r line; do