Skip to content

Commit

Permalink
remove trailing slash from base urls (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
giohappy authored Sep 4, 2023
1 parent 9ec77dc commit a88f483
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
62 changes: 31 additions & 31 deletions docker/geoserver/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,136 +18,136 @@ invoke () {
# control the values of LB settings if present
if [ -n "$GEONODE_LB_HOST_IP" ];
then
echo "GEONODE_LB_HOST_IP is defined and not empty with the value '$GEONODE_LB_HOST_IP' \n"
echo "GEONODE_LB_HOST_IP is defined and not empty with the value '$GEONODE_LB_HOST_IP' "
echo export GEONODE_LB_HOST_IP=${GEONODE_LB_HOST_IP} >> /root/.override_env
else
echo "GEONODE_LB_HOST_IP is either not defined or empty setting the value to 'django' \n"
echo "GEONODE_LB_HOST_IP is either not defined or empty setting the value to 'django' "
echo export GEONODE_LB_HOST_IP=django >> /root/.override_env
export GEONODE_LB_HOST_IP=django
fi

if [ -n "$GEONODE_LB_PORT" ];
then
echo "GEONODE_LB_HOST_IP is defined and not empty with the value '$GEONODE_LB_PORT' \n"
echo "GEONODE_LB_HOST_IP is defined and not empty with the value '$GEONODE_LB_PORT' "
echo export GEONODE_LB_PORT=${GEONODE_LB_PORT} >> /root/.override_env
else
echo "GEONODE_LB_PORT is either not defined or empty setting the value to '8000' \n"
echo "GEONODE_LB_PORT is either not defined or empty setting the value to '8000' "
echo export GEONODE_LB_PORT=8000 >> /root/.override_env
export GEONODE_LB_PORT=8000
fi

if [ -n "$GEOSERVER_LB_HOST_IP" ];
then
echo "GEOSERVER_LB_HOST_IP is defined and not empty with the value '$GEOSERVER_LB_HOST_IP' \n"
echo "GEOSERVER_LB_HOST_IP is defined and not empty with the value '$GEOSERVER_LB_HOST_IP' "
echo export GEOSERVER_LB_HOST_IP=${GEOSERVER_LB_HOST_IP} >> /root/.override_env
else
echo "GEOSERVER_LB_HOST_IP is either not defined or empty setting the value to 'geoserver' \n"
echo "GEOSERVER_LB_HOST_IP is either not defined or empty setting the value to 'geoserver' "
echo export GEOSERVER_LB_HOST_IP=geoserver >> /root/.override_env
export GEOSERVER_LB_HOST_IP=geoserver
fi

if [ -n "$GEOSERVER_LB_PORT" ];
then
echo "GEOSERVER_LB_PORT is defined and not empty with the value '$GEOSERVER_LB_PORT' \n"
echo "GEOSERVER_LB_PORT is defined and not empty with the value '$GEOSERVER_LB_PORT' "
echo export GEOSERVER_LB_PORT=${GEOSERVER_LB_PORT} >> /root/.override_env
else
echo "GEOSERVER_LB_PORT is either not defined or empty setting the value to '8000' \n"
echo "GEOSERVER_LB_PORT is either not defined or empty setting the value to '8000' "
echo export GEOSERVER_LB_PORT=8080 >> /root/.override_env
export GEOSERVER_LB_PORT=8080
fi

# If DATABASE_HOST is not set in the environment, use the default value
if [ -n "$DATABASE_HOST" ];
then
echo "DATABASE_HOST is defined and not empty with the value '$DATABASE_HOST' \n"
echo "DATABASE_HOST is defined and not empty with the value '$DATABASE_HOST' "
echo export DATABASE_HOST=${DATABASE_HOST} >> /root/.override_env
else
echo "DATABASE_HOST is either not defined or empty setting the value to 'db' \n"
echo "DATABASE_HOST is either not defined or empty setting the value to 'db' "
echo export DATABASE_HOST=db >> /root/.override_env
export DATABASE_HOST=db
fi

# If DATABASE_PORT is not set in the environment, use the default value
if [ -n "$DATABASE_PORT" ];
then
echo "DATABASE_PORT is defined and not empty with the value '$DATABASE_PORT' \n"
echo "DATABASE_PORT is defined and not empty with the value '$DATABASE_PORT' "
echo export DATABASE_HOST=${DATABASE_PORT} >> /root/.override_env
else
echo "DATABASE_PORT is either not defined or empty setting the value to '5432' \n"
echo "DATABASE_PORT is either not defined or empty setting the value to '5432' "
echo export DATABASE_PORT=5432 >> /root/.override_env
export DATABASE_PORT=5432
fi

# If GEONODE_GEODATABASE_USER is not set in the environment, use the default value
if [ -n "$GEONODE_GEODATABASE" ];
then
echo "GEONODE_GEODATABASE is defined and not empty with the value '$GEONODE_GEODATABASE' \n"
echo "GEONODE_GEODATABASE is defined and not empty with the value '$GEONODE_GEODATABASE' "
echo export GEONODE_GEODATABASE=${GEONODE_GEODATABASE} >> /root/.override_env
else
echo "GEONODE_GEODATABASE is either not defined or empty setting the value '${COMPOSE_PROJECT_NAME}_data' \n"
echo "GEONODE_GEODATABASE is either not defined or empty setting the value '${COMPOSE_PROJECT_NAME}_data' "
echo export GEONODE_GEODATABASE=${COMPOSE_PROJECT_NAME}_data >> /root/.override_env
export GEONODE_GEODATABASE=${COMPOSE_PROJECT_NAME}_data
fi

# If GEONODE_GEODATABASE_USER is not set in the environment, use the default value
if [ -n "$GEONODE_GEODATABASE_USER" ];
then
echo "GEONODE_GEODATABASE_USER is defined and not empty with the value '$GEONODE_GEODATABASE_USER' \n"
echo "GEONODE_GEODATABASE_USER is defined and not empty with the value '$GEONODE_GEODATABASE_USER' "
echo export GEONODE_GEODATABASE_USER=${GEONODE_GEODATABASE_USER} >> /root/.override_env
else
echo "GEONODE_GEODATABASE_USER is either not defined or empty setting the value '$GEONODE_GEODATABASE' \n"
echo "GEONODE_GEODATABASE_USER is either not defined or empty setting the value '$GEONODE_GEODATABASE' "
echo export GEONODE_GEODATABASE_USER=${GEONODE_GEODATABASE} >> /root/.override_env
export GEONODE_GEODATABASE_USER=${GEONODE_GEODATABASE}
fi

# If GEONODE_GEODATABASE_USER is not set in the environment, use the default value
if [ -n "$GEONODE_GEODATABASE_PASSWORD" ];
then
echo "GEONODE_GEODATABASE_PASSWORD is defined and not empty with the value '$GEONODE_GEODATABASE_PASSWORD' \n"
echo "GEONODE_GEODATABASE_PASSWORD is defined and not empty with the value '$GEONODE_GEODATABASE_PASSWORD' "
echo export GEONODE_GEODATABASE_PASSWORD=${GEONODE_GEODATABASE_PASSWORD} >> /root/.override_env
else
echo "GEONODE_GEODATABASE_PASSWORD is either not defined or empty setting the value '${GEONODE_GEODATABASE}' \n"
echo "GEONODE_GEODATABASE_PASSWORD is either not defined or empty setting the value '${GEONODE_GEODATABASE}' "
echo export GEONODE_GEODATABASE_PASSWORD=${GEONODE_GEODATABASE} >> /root/.override_env
export GEONODE_GEODATABASE_PASSWORD=${GEONODE_GEODATABASE}
fi

# If GEONODE_GEODATABASE_SCHEMA is not set in the environment, use the default value
if [ -n "$GEONODE_GEODATABASE_SCHEMA" ];
then
echo "GEONODE_GEODATABASE_SCHEMA is defined and not empty with the value '$GEONODE_GEODATABASE_SCHEMA' \n"
echo "GEONODE_GEODATABASE_SCHEMA is defined and not empty with the value '$GEONODE_GEODATABASE_SCHEMA' "
echo export GEONODE_GEODATABASE_SCHEMA=${GEONODE_GEODATABASE_SCHEMA} >> /root/.override_env
else
echo "GEONODE_GEODATABASE_SCHEMA is either not defined or empty setting the value to 'public' \n"
echo "GEONODE_GEODATABASE_SCHEMA is either not defined or empty setting the value to 'public'"
echo export GEONODE_GEODATABASE_SCHEMA=public >> /root/.override_env
export GEONODE_GEODATABASE_SCHEMA=public
fi

if [ ! -z "${GEOSERVER_JAVA_OPTS}" ]
then
echo "GEOSERVER_JAVA_OPTS is filled so I replace the value of '$JAVA_OPTS' with '$GEOSERVER_JAVA_OPTS' \n"
echo "GEOSERVER_JAVA_OPTS is filled so I replace the value of '$JAVA_OPTS' with '$GEOSERVER_JAVA_OPTS'"
export JAVA_OPTS=${GEOSERVER_JAVA_OPTS}
fi

# control the value of NGINX_BASE_URL variable
if [ -z `echo ${NGINX_BASE_URL} | sed 's/http:\/\/\([^:]*\).*/\1/'` ]
then
echo "NGINX_BASE_URL is empty so I'll use the default Geoserver location \n"
echo "Setting GEOSERVER_LOCATION='${GEOSERVER_PUBLIC_LOCATION}' \n"
echo export GEOSERVER_LOCATION=${GEOSERVER_PUBLIC_LOCATION} >> /root/.override_env
echo "NGINX_BASE_URL is empty so I'll use the default Geoserver base url"
echo "Setting GEOSERVER_LOCATION='${SITEURL}'"
echo export GEOSERVER_LOCATION=${SITEURL} >> /root/.override_env
else
echo "NGINX_BASE_URL is filled so GEOSERVER_LOCATION='${NGINX_BASE_URL}' \n"
echo "Setting GEOSERVER_LOCATION='${NGINX_BASE_URL}' \n"
echo "NGINX_BASE_URL is filled so GEOSERVER_LOCATION='${NGINX_BASE_URL}'"
echo "Setting GEOSERVER_LOCATION='${NGINX_BASE_URL}'"
echo export GEOSERVER_LOCATION=${NGINX_BASE_URL} >> /root/.override_env
fi

if [ -n "$SUBSTITUTION_URL" ];
then
echo "SUBSTITUTION_URL is defined and not empty with the value '$SUBSTITUTION_URL' \n"
echo "Setting GEONODE_LOCATION='${SUBSTITUTION_URL}' \n"
echo "SUBSTITUTION_URL is defined and not empty with the value '$SUBSTITUTION_URL'"
echo "Setting GEONODE_LOCATION='${SUBSTITUTION_URL}' "
echo export GEONODE_LOCATION=${SUBSTITUTION_URL} >> /root/.override_env
else
echo "SUBSTITUTION_URL is either not defined or empty so I'll use the default GeoNode location \n"
echo "Setting GEONODE_LOCATION='http://${GEONODE_LB_HOST_IP}:${GEONODE_LB_PORT}' \n"
echo "SUBSTITUTION_URL is either not defined or empty so I'll use the default GeoNode location "
echo "Setting GEONODE_LOCATION='http://${GEONODE_LB_HOST_IP}:${GEONODE_LB_PORT}' "
echo export GEONODE_LOCATION=http://${GEONODE_LB_HOST_IP}:${GEONODE_LB_PORT} >> /root/.override_env
fi

Expand All @@ -156,7 +156,7 @@ TAGNAME=( "baseUrl" "authApiKey" )

if ! [ -f ${GEOSERVER_DATA_DIR}/security/auth/geonodeAuthProvider/config.xml ]
then
echo "Configuration file '$GEOSERVER_DATA_DIR'/security/auth/geonodeAuthProvider/config.xml is not available so it is gone to skip \n"
echo "Configuration file '$GEOSERVER_DATA_DIR'/security/auth/geonodeAuthProvider/config.xml is not available so it is gone to skip "
else
# backup geonodeAuthProvider config.xml
cp ${GEOSERVER_DATA_DIR}/security/auth/geonodeAuthProvider/config.xml ${GEOSERVER_DATA_DIR}/security/auth/geonodeAuthProvider/config.xml.orig
Expand Down
4 changes: 2 additions & 2 deletions docker/geoserver/set_geoserver_auth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ do
newvalue=`echo -ne "$tagvalue" | sed -re "s@.*@$OAUTH2_CLIENT_SECRET@"`;;
proxyBaseUrl | redirectUri | userAuthorizationUri | logoutUri )
echo "DEBUG: Editing '$auth_conf_source' for tagname <$i> and replacing its value with '$GEOSERVER_LOCATION'"
newvalue=`echo -ne "$tagvalue" | sed -re "s@^(https?://[^/]+)@$GEOSERVER_LOCATION@"`;;
newvalue=`echo -ne "$tagvalue" | sed -re "s@^(https?://[^/]+)@${GEOSERVER_LOCATION%/}@"`;;
baseUrl | accessTokenUri | checkTokenEndpointUrl )
echo "DEBUG: Editing '$auth_conf_source' for tagname <$i> and replacing its value with '$GEONODE_LOCATION'"
newvalue=`echo -ne "$tagvalue" | sed -re "s@^(https?://[^/]+)@$GEONODE_LOCATION@"`;;
newvalue=`echo -ne "$tagvalue" | sed -re "s@^(https?://[^/]+)@${GEONODE_LOCATION%/}@"`;;
*) echo -n "an unknown variable has been found";;
esac

Expand Down

0 comments on commit a88f483

Please sign in to comment.