From 39a7562dedd8f3aecb16ada486fa48a888ba6a00 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Wed, 16 Oct 2024 21:55:13 +0200 Subject: [PATCH] chg: [nextcloud] avoid send password environment information when it is not used --- nextcloud/hooks/init | 2 -- nextcloud/lib/common | 17 ++++++----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/nextcloud/hooks/init b/nextcloud/hooks/init index fafac22..7753b55 100755 --- a/nextcloud/hooks/init +++ b/nextcloud/hooks/init @@ -84,8 +84,6 @@ fi init-config-add "\ $MASTER_BASE_SERVICE_NAME: environment: - NEXTCLOUD_ADMIN_USER: $admin_user - NEXTCLOUD_ADMIN_PASSWORD: $admin_password NEXTCLOUD_DATA_DIR: /var/lib/nextcloud/data NEXTCLOUD_TRUSTED_DOMAINS: '\*' " diff --git a/nextcloud/lib/common b/nextcloud/lib/common index 100f1ca..1e62058 100644 --- a/nextcloud/lib/common +++ b/nextcloud/lib/common @@ -90,21 +90,16 @@ create_occ_if_not_exists() { ## bare-minimum nextcloud run AND we will use occ to set some info ## in this very same relation. - ## Note also that ``init`` is required as it sets - ## NEXTCLOUD_ADMIN_{USER,PASSWORD} that is required to trigger - ## a full installation + ## Note also that we need to set NEXTCLOUD_ADMIN_{USER,PASSWORD} + ## that is required to trigger a full installation if ! out=$( export COMPOSE_IGNORE_ORPHANS=true - ## XXXvlab: this is to avoid re-running init from - ## apache (if provided in compose.yml) that is bugged - ## and will delete all config. It'll be run even if it - ## seems excluded because ALL_RELATION is already - ## solved. These are 2 mishaps that will need to be - ## addressed in compose-core. - export ALL_RELATIONS= - compose --debug --without-relation="$SERVICE_NAME":web-proxy run \ + read-0 LOGIN PASSWORD < "$PASSWORD_FILE" || exit 1 + compose --debug --no-init --without-relation="$SERVICE_NAME":web-proxy run \ -v "$CHARM_PATH"/src/fake-apache:/usr/bin/apache \ + -e NEXTCLOUD_ADMIN_USER=$LOGIN \ + -e NEXTCLOUD_ADMIN_PASSWORD=$PASSWORD \ --rm --entrypoint /entrypoint.sh "$SERVICE_NAME" apache 2>&1 ); then err "Initialization of code or database failed unexpectedly"