more fix and update

This commit is contained in:
lendry
2026-06-24 20:15:19 +03:00
parent dcab6557d3
commit 9727cf3f35
53 changed files with 3479 additions and 494 deletions

View File

@@ -957,9 +957,54 @@ persist_domain_env() {
env_set LDAP_EXTRA_HOSTS "$(env_get LDAP_EXTRA_HOSTS "")"
ok "Файл .env обновлён"
derive_ldap_dns_settings
}
derive_ldap_dns_settings() {
load_env
local extra dns first ip
extra="$(env_get LDAP_EXTRA_HOSTS "")"
[[ -n "$extra" ]] || return 0
dns="$(env_get LDAP_DNS_SERVERS "")"
if [[ -z "$dns" ]]; then
first="${extra%%,*}"
ip="${first##*:}"
ip="$(echo "$ip" | xargs)"
if [[ -n "$ip" ]]; then
env_set LDAP_DNS_SERVERS "$ip"
log "LDAP_DNS_SERVERS=${ip} (из LDAP_EXTRA_HOSTS)"
fi
fi
}
sync_ldap_system_hosts() {
load_env
local extra
extra="$(env_get LDAP_EXTRA_HOSTS "")"
[[ -n "$extra" ]] || return 0
log "LDAP: запись имён DC в /etc/hosts..."
local entry host ip
IFS=',' read -ra _entries <<< "$extra"
for entry in "${_entries[@]}"; do
entry="$(echo "$entry" | xargs)"
[[ "$entry" == *:* ]] || continue
host="${entry%%:*}"
host="$(echo "$host" | xargs)"
ip="${entry##*:}"
ip="$(echo "$ip" | xargs)"
[[ -n "$host" && -n "$ip" ]] || continue
if run_root grep -qE "[[:space:]]${host}([[:space:]]|$)" /etc/hosts 2>/dev/null; then
continue
fi
run_root sh -c "printf '%s %s\n' '${ip}' '${host}' >> /etc/hosts" || warn "Не удалось добавить ${host} в /etc/hosts (нужен sudo?)"
done
}
write_compose_override() {
derive_ldap_dns_settings
sync_ldap_system_hosts
resolve_nginx_mode_and_ports
load_env
local mode="${NGINX_MODE:-$(env_get NGINX_MODE host)}"
@@ -2035,6 +2080,10 @@ action_fix_host_proxy() {
apply_intranet_selfsigned_runtime
log "Шаг 5/5: пересоздание ldap-auth и sso-core..."
build_compose_stack_cmd
docker_cmd "${COMPOSE_STACK_CMD[@]}" up -d --build --force-recreate ldap-auth sso-core
ok "Прокси исправлен — проверьте: curl -I http://127.0.0.1:3002"
show_status
}