[bitnami/keycloak] Allow to prepend run flags (#10071)

* feat: add env variable KEYCLOAK_EXTRA_ARGS_PREPENDED

Signed-off-by: German Öö <german.oo@hey.com>

* docs: add doc about prepended args

Signed-off-by: German Öö <german.oo@hey.com>

Signed-off-by: German Öö <german.oo@hey.com>
Co-authored-by: German Öö <german.oo@hey.com>
This commit is contained in:
German Öö
2022-10-17 10:58:20 +01:00
committed by GitHub
parent 6efe9288c6
commit 77037de14b
3 changed files with 19 additions and 1 deletions

View File

@@ -34,6 +34,7 @@ keycloak_env_vars=(
KEYCLOAK_CACHE_TYPE
KEYCLOAK_CACHE_STACK
KEYCLOAK_EXTRA_ARGS
KEYCLOAK_EXTRA_ARGS_PREPENDED
KEYCLOAK_ENABLE_STATISTICS
KEYCLOAK_ENABLE_TLS
KEYCLOAK_TLS_TRUSTSTORE_FILE
@@ -108,6 +109,7 @@ export KEYCLOAK_INIT_MAX_RETRIES="${KEYCLOAK_INIT_MAX_RETRIES:-10}"
export KEYCLOAK_CACHE_TYPE="${KEYCLOAK_CACHE_TYPE:-ispn}"
export KEYCLOAK_CACHE_STACK="${KEYCLOAK_CACHE_STACK:-}"
export KEYCLOAK_EXTRA_ARGS="${KEYCLOAK_EXTRA_ARGS:-}"
export KEYCLOAK_EXTRA_ARGS_PREPENDED="${KEYCLOAK_EXTRA_ARGS_PREPENDED:-}"
export KEYCLOAK_ENABLE_STATISTICS="${KEYCLOAK_ENABLE_STATISTICS:-false}"
export KEYCLOAK_ENABLE_TLS="${KEYCLOAK_ENABLE_TLS:-false}"
export KEYCLOAK_TLS_TRUSTSTORE_FILE="${KEYCLOAK_TLS_TRUSTSTORE_FILE:-}"

View File

@@ -21,7 +21,15 @@ conf_file="${KEYCLOAK_CONF_DIR}/${KEYCLOAK_CONF_FILE}"
is_boolean_yes "$KEYCLOAK_PRODUCTION" && start_param="start" || start_param="start-dev"
start_command=("${KEYCLOAK_BIN_DIR}/kc.sh" "-cf" "$conf_file" "$start_param")
start_command=("${KEYCLOAK_BIN_DIR}/kc.sh" "-cf" "$conf_file")
# Prepend extra args
if [[ -n "$KEYCLOAK_EXTRA_ARGS_PREPENDED" ]]; then
read -r -a extra_args_prepended <<<"$KEYCLOAK_EXTRA_ARGS_PREPENDED"
start_command+=("${extra_args_prepended[@]}")
fi
start_command+=("$start_param")
# Add extra args
if [[ -n "$KEYCLOAK_EXTRA_ARGS" ]]; then

View File

@@ -111,6 +111,14 @@ $ docker run --name keycloak \
bitnami/keycloak:latest
```
Or, if you need flags which are applied directly to keycloak executable, you can use `KEYCLOAK_EXTRA_ARGS_PREPENDED` variable. Example:
```console
$ docker run --name keycloak \
-e KEYCLOAK_EXTRA_ARGS_PREPENDED="--spi-login-protocol-openid-connect-legacy-logout-redirect-uri=true" \
bitnami/keycloak:latest
```
### Initializing a new instance
When the container is launched, it will execute the files with extension `.sh` located at `/docker-entrypoint-initdb.d`.