fix: recursively update explicit ports in imported Caddy configuration files
Main / build (push) Waiting to run
Main / build (push) Waiting to run
This commit is contained in:
+11
@@ -172,6 +172,11 @@ update_caddyfile_fallback() {
|
|||||||
# Prepend a new global block at the very top of the Caddyfile
|
# Prepend a new global block at the very top of the Caddyfile
|
||||||
echo -e "{\n https_port 4443\n}\n$(cat $is_caddyfile)" >$is_caddyfile
|
echo -e "{\n https_port 4443\n}\n$(cat $is_caddyfile)" >$is_caddyfile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 4. Replace any explicit :443 in other conf files inside /etc/caddy/sing-box/
|
||||||
|
if [[ -d /etc/caddy/sing-box ]]; then
|
||||||
|
sed -i 's/:443\b/:4443/g' /etc/caddy/sing-box/*.conf 2>/dev/null
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_haproxy() {
|
install_haproxy() {
|
||||||
@@ -197,6 +202,12 @@ restore_caddy_default() {
|
|||||||
sed -i 's/:4443[[:space:]]*{/:443 {/g' $is_caddyfile
|
sed -i 's/:4443[[:space:]]*{/:443 {/g' $is_caddyfile
|
||||||
sed -i 's/https_port 4443/https_port 443/g' $is_caddyfile
|
sed -i 's/https_port 4443/https_port 443/g' $is_caddyfile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Restore explicit :4443 in other conf files inside /etc/caddy/sing-box/
|
||||||
|
if [[ -d /etc/caddy/sing-box ]]; then
|
||||||
|
sed -i 's/:4443\b/:443/g' /etc/caddy/sing-box/*.conf 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
systemctl restart caddy >/dev/null 2>&1
|
systemctl restart caddy >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user