From 6ef88beab090e64be7ace4c5111cdec7c3baa518 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Thu, 20 Feb 2025 09:55:15 +0100 Subject: [PATCH] Revert https://github.com/alexbelgium/hassio-addons/issues/1775#issuecomment-2670840167 --- immich/rootfs/etc/cont-init.d/99-run.sh | 45 +++++++++++++------------ 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/immich/rootfs/etc/cont-init.d/99-run.sh b/immich/rootfs/etc/cont-init.d/99-run.sh index 5bbbc3141..3f6c56916 100755 --- a/immich/rootfs/etc/cont-init.d/99-run.sh +++ b/immich/rootfs/etc/cont-init.d/99-run.sh @@ -13,13 +13,11 @@ export_options() { for key in "${keys[@]}"; do local value value=$(jq -r ".${key}" "${json_source}") - # Hide passwords if bashio::config.false "verbose" || [[ "$key" == *"PASS"* ]]; then bashio::log.blue "${key}=******" else bashio::log.blue "${key}='${value}'" fi - # Export value export "${key}=${value}" done } @@ -89,7 +87,7 @@ setup_root_user() { else bashio::log.warning "DB_ROOT_PASSWORD not set. Generating a random 12-character alphanumeric password and storing it in the addon options." export DB_ROOT_PASSWORD="$(tr -dc 'A-Za-z0-9' /dev/null; then - # If successful, root has the default password; update it + # Try to connect as root using the default insecure password. + if psql "postgres://root:securepassword@${DB_HOSTNAME}:${DB_PORT}/postgres" -c '\q' 2>/dev/null; then bashio::log.info "Detected root user with default password. Updating to new DB_ROOT_PASSWORD..." - PGPASSWORD="securepassword" psql -U root -h "${DB_HOSTNAME}" -p "${DB_PORT}" -d postgres <