mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
AAE-4023 fix add slash to url if missing (#1823)
This commit is contained in:
58
docker/default.conf.template
Normal file
58
docker/default.conf.template
Normal file
@@ -0,0 +1,58 @@
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
#charset koi8-r;
|
||||
#access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
rewrite ^([^.]*[^/])$ $1/ permanent;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
location = /app.config.json {
|
||||
root ${NGINX_ENVSUBST_OUTPUT_DIR};
|
||||
}
|
||||
|
||||
location ${BASE_PATH} {
|
||||
alias /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
location = ${BASE_PATH}/app.config.json {
|
||||
alias ${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json;
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
# 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;
|
||||
#}
|
||||
}
|
102
docker/docker-entrypoint.d/30-sed-on-appconfig.sh
Executable file
102
docker/docker-entrypoint.d/30-sed-on-appconfig.sh
Executable file
@@ -0,0 +1,102 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
echo Running sed on "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
|
||||
if [ -n "${APP_CONFIG_AUTH_TYPE}" ]; then
|
||||
sed -e "s/\"authType\": \".*\"/\"authType\": \"${APP_CONFIG_AUTH_TYPE}\"/g" \
|
||||
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_IDENTITY_HOST}" ]; then
|
||||
replace="\/"
|
||||
encodedIdentity=${APP_CONFIG_IDENTITY_HOST//\//$replace}
|
||||
sed -e "s/\"identityHost\": \".*\"/\"identityHost\": \"$encodedIdentity\"/g" \
|
||||
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_OAUTH2_HOST}" ]; then
|
||||
replace="\/"
|
||||
encoded=${APP_CONFIG_OAUTH2_HOST//\//$replace}
|
||||
sed -e "s/\"host\": \".*\"/\"host\": \"${encoded}\"/g" \
|
||||
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_OAUTH2_CLIENTID}" ]; then
|
||||
sed -e "s/\"clientId\": \".*\"/\"clientId\": \"${APP_CONFIG_OAUTH2_CLIENTID}\"/g" \
|
||||
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_OAUTH2_IMPLICIT_FLOW}" ]; then
|
||||
sed -e "s/\"implicitFlow\": [^,]*/\"implicitFlow\": ${APP_CONFIG_OAUTH2_IMPLICIT_FLOW}/g" \
|
||||
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_OAUTH2_SILENT_LOGIN}" ]; then
|
||||
sed -e "s/\"silentLogin\": [^,]*/\"silentLogin\": ${APP_CONFIG_OAUTH2_SILENT_LOGIN}/g" \
|
||||
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI}" ]; then
|
||||
replace="\/"
|
||||
encoded=${APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI//\//$replace}
|
||||
sed -e "s/\"redirectSilentIframeUri\": \".*\"/\"redirectSilentIframeUri\": \"${encoded}\"/g" \
|
||||
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_OAUTH2_REDIRECT_LOGIN}" ]; then
|
||||
replace="\/"
|
||||
encoded=${APP_CONFIG_OAUTH2_REDIRECT_LOGIN//\//$replace}
|
||||
sed -e "s/\"redirectUri\": \".*\"/\"redirectUri\": \"${encoded}\"/g" \
|
||||
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_OAUTH2_REDIRECT_LOGOUT}" ]; then
|
||||
replace="\/"
|
||||
encoded=${APP_CONFIG_OAUTH2_REDIRECT_LOGOUT//\//$replace}
|
||||
sed -e "s/\"redirectUriLogout\": \".*\"/\"redirectUriLogout\": \"${encoded}\"/g" \
|
||||
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
fi
|
||||
|
||||
if [[ -n "${APP_CONFIG_BPM_HOST}" ]]; then
|
||||
replace="\/"
|
||||
encoded=${APP_CONFIG_BPM_HOST//\//$replace}
|
||||
sed -e "s/\"bpmHost\": \".*\"/\"bpmHost\": \"${encoded}\"/g" \
|
||||
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
fi
|
||||
|
||||
if [[ -n "${APP_CONFIG_ECM_HOST}" ]]; then
|
||||
replace="\/"
|
||||
encoded=${APP_CONFIG_ECM_HOST//\//$replace}
|
||||
sed -e "s/\"ecmHost\": \".*\"/\"ecmHost\": \"${encoded}\"/g" \
|
||||
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
else
|
||||
sed -e "s/\"ecmHost\": \".*\"/\"ecmHost\": \"\"/g" \
|
||||
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
fi
|
||||
|
||||
if [ -n "${APP_ALLOW_CUSTOM_RESOURCES}" ]; then
|
||||
sed -e "s/\"allowCustomResources\": [^,]*/\"allowCustomResources\": ${APP_ALLOW_CUSTOM_RESOURCES}/g" \
|
||||
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_APPS_DEPLOYED}" ]; then
|
||||
sed -e "s/\"alfresco-deployed-apps\": \[.*\]/\"alfresco-deployed-apps\": ${APP_CONFIG_APPS_DEPLOYED}/g" \
|
||||
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
fi
|
||||
|
||||
if [ -n "${ENABLE_CUSTOM_CONNECTORS}" ]; then
|
||||
sed -e "s/\"enableCustomConnectors\": [^,]*/\"enableCustomConnectors\": ${ENABLE_CUSTOM_CONNECTORS}/g" \
|
||||
-i "${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json"
|
||||
fi
|
||||
|
||||
# application specific ce replacements
|
||||
|
||||
if [ -n "${APP_BASE_SHARE_URL}" ];then
|
||||
replace="\/"
|
||||
encoded=${APP_BASE_SHARE_URL//\//$replace}
|
||||
sed -e "s/\"baseShareUrl\": \".*\"/\"baseShareUrl\": \"${encoded}\"/g" \
|
||||
-i /tmp/app.config.json && \
|
||||
cat /tmp/app.config.json > ./app.config.json
|
||||
fi
|
@@ -1,104 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
cp ./app.config.json /tmp/app.config.json
|
||||
cp ./index.html /tmp/index.html
|
||||
|
||||
if [ -n "${APP_CONFIG_AUTH_TYPE}" ];then
|
||||
sed -e "s/\"authType\": \".*\"/\"authType\": \"${APP_CONFIG_AUTH_TYPE}\"/g" \
|
||||
-i /tmp/app.config.json && \
|
||||
cat /tmp/app.config.json > ./app.config.json
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_OAUTH2_HOST}" ];then
|
||||
replace="\/"
|
||||
encoded=${APP_CONFIG_OAUTH2_HOST//\//$replace}
|
||||
sed -e "s/\"host\": \".*\"/\"host\": \"${encoded}\"/g" \
|
||||
-i /tmp/app.config.json && \
|
||||
cat /tmp/app.config.json > ./app.config.json
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_OAUTH2_CLIENTID}" ];then
|
||||
sed -e "s/\"clientId\": \".*\"/\"clientId\": \"${APP_CONFIG_OAUTH2_CLIENTID}\"/g" \
|
||||
-i /tmp/app.config.json && \
|
||||
cat /tmp/app.config.json > ./app.config.json
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_OAUTH2_IMPLICIT_FLOW}" ];then
|
||||
sed "/implicitFlow/s/true/${APP_CONFIG_OAUTH2_IMPLICIT_FLOW}/" \
|
||||
-i /tmp/app.config.json && \
|
||||
cat /tmp/app.config.json > ./app.config.json
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_OAUTH2_SILENT_LOGIN}" ];then
|
||||
sed "/silentLogin/s/true/${APP_CONFIG_OAUTH2_SILENT_LOGIN}/" \
|
||||
-i /tmp/app.config.json && \
|
||||
cat /tmp/app.config.json > ./app.config.json
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI}" ];then
|
||||
replace="\/"
|
||||
encoded=${APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI//\//$replace}
|
||||
sed -e "s/\"redirectSilentIframeUri\": \".*\"/\"redirectSilentIframeUri\": \"${encoded}\"/g" \
|
||||
-i /tmp/app.config.json && \
|
||||
cat /tmp/app.config.json > ./app.config.json
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_OAUTH2_REDIRECT_LOGIN}" ];then
|
||||
replace="\/"
|
||||
encoded=${APP_CONFIG_OAUTH2_REDIRECT_LOGIN//\//$replace}
|
||||
sed -e "s/\"redirectUri\": \".*\"/\"redirectUri\": \"${encoded}\"/g" \
|
||||
-i /tmp/app.config.json && \
|
||||
cat /tmp/app.config.json > ./app.config.json
|
||||
fi
|
||||
|
||||
if [ -n "${APP_CONFIG_OAUTH2_REDIRECT_LOGOUT}" ];then
|
||||
replace="\/"
|
||||
encoded=${APP_CONFIG_OAUTH2_REDIRECT_LOGOUT//\//$replace}
|
||||
sed -e "s/\"redirectUriLogout\": \".*\"/\"redirectUriLogout\": \"${encoded}\"/g" \
|
||||
-i /tmp/app.config.json && \
|
||||
cat /tmp/app.config.json > ./app.config.json
|
||||
fi
|
||||
|
||||
if [[ -n "${APP_CONFIG_BPM_HOST}" ]]
|
||||
then
|
||||
replace="\/"
|
||||
encoded=${APP_CONFIG_BPM_HOST//\//$replace}
|
||||
sed -e "s/\"bpmHost\": \".*\"/\"bpmHost\": \"${encoded}\"/g" \
|
||||
-i /tmp/app.config.json && \
|
||||
cat /tmp/app.config.json > ./app.config.json
|
||||
fi
|
||||
|
||||
if [[ -n "${APP_CONFIG_ECM_HOST}" ]]
|
||||
then
|
||||
replace="\/"
|
||||
encoded=${APP_CONFIG_ECM_HOST//\//$replace}
|
||||
sed -e "s/\"ecmHost\": \".*\"/\"ecmHost\": \"${encoded}\"/g" \
|
||||
-i /tmp/app.config.json && \
|
||||
cat /tmp/app.config.json > ./app.config.json
|
||||
fi
|
||||
|
||||
if [[ $BASE_PATH ]]; then
|
||||
replace="\/"
|
||||
encoded=${BASE_PATH//\//$replace}
|
||||
sed -ri 's%href=".?/"%href="'$encoded'"%g' /tmp/index.html && \
|
||||
cat /tmp/index.html > ./index.html
|
||||
fi
|
||||
|
||||
if [ -n "${APP_BASE_SHARE_URL}" ];then
|
||||
replace="\/"
|
||||
encoded=${APP_BASE_SHARE_URL//\//$replace}
|
||||
sed -e "s/\"baseShareUrl\": \".*\"/\"baseShareUrl\": \"${encoded}\"/g" \
|
||||
-i /tmp/app.config.json && \
|
||||
cat /tmp/app.config.json > ./app.config.json
|
||||
fi
|
||||
|
||||
if [[ $SERVER_PATH ]]; then
|
||||
mkdir -p .$SERVER_PATH
|
||||
cp -R * .$SERVER_PATH
|
||||
replace="\/"
|
||||
encoded=${SERVER_PATH//\//$replace}
|
||||
sed -ri 's%href=".?/"%href="'$encoded/'"%g' /tmp/index.html && \
|
||||
cat /tmp/index.html > .$SERVER_PATH/index.html
|
||||
fi
|
||||
|
||||
nginx -g "daemon off;"
|
@@ -1,37 +0,0 @@
|
||||
pid /tmp/nginx.pid;
|
||||
worker_processes 1;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
client_body_temp_path /tmp/client_temp;
|
||||
proxy_temp_path /tmp/proxy_temp_path;
|
||||
fastcgi_temp_path /tmp/fastcgi_temp;
|
||||
uwsgi_temp_path /tmp/uwsgi_temp;
|
||||
scgi_temp_path /tmp/scgi_temp;
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
include /etc/nginx/mime.types;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1000;
|
||||
gzip_proxied expired no-cache no-store private auth;
|
||||
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location ~ \.html$ {
|
||||
add_header Cache-Control "private, no-cache, no-store, must-revalidate";
|
||||
add_header Expires "Sat, 01 Jan 2000 00:00:00 GMT";
|
||||
add_header Pragma no-cache;
|
||||
}
|
||||
}
|
||||
}
|
5
docker/run-content-ce.sh
Executable file
5
docker/run-content-ce.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
env PROJECT_NAME=app BASE_PATH=/workspace DOCKER_IMAGE_REPO=alfresco/alfresco-content-app $(dirname "$0")/run.sh
|
17
docker/run.sh
Executable file
17
docker/run.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ "$BUILD_ENABLED" == "true" ]]
|
||||
then
|
||||
npm clean-install
|
||||
npm run build
|
||||
fi
|
||||
docker rmi -f $DOCKER_IMAGE_REPO
|
||||
docker build --build-arg PROJECT_NAME=$PROJECT_NAME -t $DOCKER_IMAGE_REPO .
|
||||
echo http://localhost:8080$BASE_PATH
|
||||
docker run --rm -it \
|
||||
--env BASE_PATH=$BASE_PATH \
|
||||
--env IDENTITY_HOST=$IDENTITY_HOST \
|
||||
--env OAUTH_HOST=$OAUTH_HOST \
|
||||
--user 1000:1000 --publish 8080:8080 $DOCKER_IMAGE_REPO
|
Reference in New Issue
Block a user