From 3f931009c569717ca1a92673d075737bd7c85ba5 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Fri, 12 Oct 2018 14:49:37 +0200 Subject: [PATCH] add a mechanism to set trusted domains on install --- README.md | 3 +++ docker-entrypoint.sh | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e87f8312..8640fabb 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,9 @@ If you want you can set the data directory and table prefix, otherwise default v - `NEXTCLOUD_DATA_DIR` (default: _/var/www/html/data_) Configures the data directory where nextcloud stores all files from the users. - `NEXTCLOUD_TABLE_PREFIX` (default: _""_) Optional prefix for the tables. Used to be `oc_` in the past +One or more trusted domains can be set by environemnt variable, too. They will be added to the configuration after install. + +- `NEXTCLOUD_TRUSTED_DOMAINS` (not set by default) Optional space-separated list of domains # Running this image with docker-compose The easiest way to get a fully featured and functional setup is using a `docker-compose` file. There are too many different possibilities to setup your system, so here are only some examples what you have to look for. diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index c1c106c1..1f03c913 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -88,7 +88,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then install_options=$install_options' --database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST"' install=true fi - + if [ "$install" = true ]; then echo "starting nexcloud installation" max_retries=10 @@ -103,6 +103,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then echo "installing of nextcloud failed!" exit 1 fi + if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then + echo "setting trusted domains…" + NC_TRUSTED_DOMAIN_IDX=1 + for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do + DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN" + NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1)) + done + fi else echo "running web-based installer on first connect!" fi