From 14bf16d8c10666c29c4d7e2ba3526fce7a2470a9 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 18 Jan 2024 00:45:54 +0300 Subject: [PATCH] updated nextcloud config generation... Signed-off-by: Alex A. Naanou --- nextcloud/make.sh | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/nextcloud/make.sh b/nextcloud/make.sh index 96cb957..80547dc 100755 --- a/nextcloud/make.sh +++ b/nextcloud/make.sh @@ -96,12 +96,31 @@ echo "# Updating config..." /var/www/nextcloud/config/config.php" # add self IP to trusted_domains -- enable setup from local network... -# XXX is this actually needed??? -#IP=$([ -z $DRY_RUN ] && lxc-attach $ID -- hostname -I) -#@ lxc-attach $ID -- bash -c "\ -# sed -z -i \ -# -e \"s/\\(trusted_domains[^)]*\\)/\\1 2 => '${IP/ *}',\\n /\" \ -# /var/www/nextcloud/config/config.php" +# XXX the gate stuff might not be needed... +# XXX is the IP actually needed??? +IP=$([ -z $DRY_RUN ] && lxc-attach $ID -- hostname -I) +TRUSTED_DOMAINS = ( + "${IP/ *}" + "$CTHOSTNAME" + "${CTHOSTNAME}.srv" + "${GATE_LAN_IPn}" + "$(GATE_HOSTNAME)" + "$(GATE_HOSTNAME).srv" + "${WAN_IPn}" +) +ADDRS= +i=2 +for addr in "${TRUSTED_DOMAINS[@]}" ; do + if [ -z "$addr" ] ; then + continue + fi + ADDRS="${ADDTS} $i => '${addr//\//\\/}',\\n" + i=$(( i + 1 )) +done +@ lxc-attach $ID -- bash -c "\ + sed -z -i \ + -e \"s/\\(trusted_domains[^)]*\\)/\\1${ADDRS}/\" \ + /var/www/nextcloud/config/config.php" # remove /index.php from urls... # for more info see: