#!/bin/bash -x export PATH=/opt/keycloak/bin:$PATH for file in /run/secrets/* ; do . "$file" done # perform an authentication as admin so that all other scripts can # use the cached credentials kcadm.sh \ config credentials \ --server http://keycloak:8080/ \ --user admin \ --password "$KEYCLOAK_ADMIN_PASSWORD" \ --realm master \ || exit 1 if ! kcadm.sh get realms/$REALM ; then echo >&2 "***** Creating realm $REALM" kcadm.sh \ create realms \ -s "realm=$REALM" \ -s enabled=true \ || exit 1 fi for file in /keycloak-setup/* ; do echo >&2 "$file: running setup" $file || exit 1 done