diff --git a/README.md b/README.md index d75f492a4..52a616acc 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ reflect the base URL of a Dependency-Track server. ![Deployment Options](https://raw.githubusercontent.com/DependencyTrack/frontend/master/docs/images/Frontend-Deployment.svg?sanitize=true) The front-end is deployed to a general purpose web server (e.g. NGINX or Apache). To configure the front-end -for this scenario, simply change the value of API_BASE_URL in static/config.json. +for this scenario, simply copy `static/config.tmpl.json` to `static/config.json` and change the value of API_BASE_URL in `static/config.json`. ```json { diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index f6dc780e6..b93c6104b 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -3,25 +3,21 @@ set -e CONFIG_FILE="./static/config.json" -TMP_FILE="/tmp/config.json" +TEMPLATE_FILE="./static/config.tmpl.json" -# Check if config.json is mounted -if ! touch $CONFIG_FILE 2>/dev/null; then - echo "can not modify config.json - ENV configuration will be ignored" +# Check if config.json exists +if test -f $CONFIG_FILE; then + echo "config.json already exists - ENV variables will be ignored" else - # Apply ENV vars to temporary config.json + echo "Creating config.json using ENV variables" jq '.API_BASE_URL = env.API_BASE_URL - | .API_WITH_CREDENTIALS = env.API_WITH_CREDENTIALS + | .API_WITH_CREDENTIALS = env.API_WITH_CREDENTIALS | .OIDC_ISSUER = env.OIDC_ISSUER | .OIDC_CLIENT_ID = env.OIDC_CLIENT_ID | .OIDC_SCOPE = env.OIDC_SCOPE | .OIDC_FLOW = env.OIDC_FLOW | .OIDC_LOGIN_BUTTON_TEXT = env.OIDC_LOGIN_BUTTON_TEXT' \ - $CONFIG_FILE > $TMP_FILE - - # Override default config file - mv -f $TMP_FILE $CONFIG_FILE + $TEMPLATE_FILE > $CONFIG_FILE fi exec "$@" - diff --git a/public/static/config.json b/public/static/config.tmpl.json similarity index 100% rename from public/static/config.json rename to public/static/config.tmpl.json