23 lines
768 B
Bash
Executable File
23 lines
768 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
#set -x
|
|
|
|
KEYCLOAK_PATH=${1:?First parameter is the directory env and config files are relative to}
|
|
KEYCLOAK_FILENAME=${2:?Second parameter is the keycloak filename of the realm without extension}
|
|
ENV_FILE=${3:?Second parameter is a comma-separated list of .env file which has exported template variables}
|
|
FINAL_CONFIG_FILE=${4:?Forth parameter is the name of the final config file. It is relative to where this script is run from}
|
|
|
|
source $ENV_FILE
|
|
|
|
parentdir="$(dirname "$FINAL_CONFIG_FILE")"
|
|
mkdir -p $parentdir
|
|
|
|
echo "" > $FINAL_CONFIG_FILE
|
|
|
|
for f in $($SCRIPT/find-template-files "${PROFILES}" $KEYCLOAK_PATH $KEYCLOAK_FILENAME "json")
|
|
do
|
|
envsubst < $f >> $FINAL_CONFIG_FILE
|
|
done
|