From 0ed0a1047108c54067a52555c7f07945cf0a8f82 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 9 Dec 2020 12:30:53 +0000 Subject: [PATCH] disable about and settings by default (#1868) * disable about and settings by default * support docker variables * remove comments --- Dockerfile | 1 + docker/default.conf.template | 33 ++----------------- .../30-sed-on-app-extensions.sh | 15 +++++++++ docker/run.sh | 1 + src/assets/app.extensions.json | 1 + 5 files changed, 21 insertions(+), 30 deletions(-) create mode 100755 docker/docker-entrypoint.d/30-sed-on-app-extensions.sh diff --git a/Dockerfile b/Dockerfile index 613d7ab91..62260a2ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,7 @@ COPY docker/docker-entrypoint.d/* /docker-entrypoint.d/ COPY dist/$PROJECT_NAME /usr/share/nginx/html/ COPY dist/$PROJECT_NAME/app.config.json /etc/nginx/templates/app.config.json.template +COPY dist/$PROJECT_NAME/assets/app.extensions.json /etc/nginx/templates/app.extensions.json.template COPY --from=builder /usr/src/alfresco/licenses /usr/share/nginx/html/ USER root diff --git a/docker/default.conf.template b/docker/default.conf.template index 36bb7fdfe..981b01beb 100644 --- a/docker/default.conf.template +++ b/docker/default.conf.template @@ -1,10 +1,6 @@ server { listen 8080; server_name localhost; - - #charset koi8-r; - #access_log /var/log/nginx/host.access.log main; - root /usr/share/nginx/html; rewrite ^([^.]*[^/])$ $1/ permanent; @@ -23,35 +19,12 @@ server { alias ${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json; } - #error_page 404 /404.html; + location ~ /assets/app.extensions.json { + alias ${NGINX_ENVSUBST_OUTPUT_DIR}/app.extensions.json; + } - # redirect server error pages to the static page /50x.html - # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } - - # proxy the PHP scripts to Apache listening on 127.0.0.1:80 - # - #location ~ \.php$ { - # proxy_pass http://127.0.0.1; - #} - - # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 - # - #location ~ \.php$ { - # root html; - # fastcgi_pass 127.0.0.1:9000; - # fastcgi_index index.php; - # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; - # include fastcgi_params; - #} - - # deny access to .htaccess files, if Apache's document root - # concurs with nginx's one - # - #location ~ /\.ht { - # deny all; - #} } diff --git a/docker/docker-entrypoint.d/30-sed-on-app-extensions.sh b/docker/docker-entrypoint.d/30-sed-on-app-extensions.sh new file mode 100755 index 000000000..8605eee2e --- /dev/null +++ b/docker/docker-entrypoint.d/30-sed-on-app-extensions.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +echo Running sed on "${NGINX_ENVSUBST_OUTPUT_DIR}/assets/app.extensions.json" + +# modifies the "$ignoreReferenceList" property using a comma-delimited string +if [ -n "${APP_EXTENSIONS_IGNORE_REFS}" ]; then +echo "replace APP_EXTENSIONS_IGNORE_REFS" + + replace="\/" + encoded=${APP_EXTENSIONS_IGNORE_REFS//\//$replace} + sed -e "s/\"$ignoreReferenceList\": \".*\"/\"$ignoreReferenceList\": \[${encoded}\]/g" \ + -i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.extensions.json" +fi diff --git a/docker/run.sh b/docker/run.sh index 41878b369..701965152 100755 --- a/docker/run.sh +++ b/docker/run.sh @@ -21,4 +21,5 @@ docker run --rm -it \ --env APP_CONFIG_BPM_HOST=$APP_CONFIG_BPM_HOST \ --env APP_CONFIG_ECM_HOST=$APP_CONFIG_ECM_HOST \ --env APP_BASE_SHARE_URL=$APP_BASE_SHARE_URL \ + --env APP_EXTENSIONS_IGNORE_REFS=$APP_EXTENSIONS_IGNORE_REFS \ --user 1000:1000 --publish $HOST_PORT:$CONTAINER_PORT $DOCKER_IMAGE_REPO diff --git a/src/assets/app.extensions.json b/src/assets/app.extensions.json index 6c5d3a0bb..e437c898b 100644 --- a/src/assets/app.extensions.json +++ b/src/assets/app.extensions.json @@ -8,6 +8,7 @@ "$runtime": "1.7.0", "$description": "Core application extensions and features", "$references": [], + "$ignoreReferenceList": ["about.plugin.json", "settings.plugin.json"], "rules": [ {