mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-17 21:37:35 +00:00
24 lines
613 B
Bash
24 lines
613 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
# ----------------------------------------------------------------
|
||
|
# generates necessary ZITADEL keys
|
||
|
# ----------------------------------------------------------------
|
||
|
|
||
|
set -e
|
||
|
|
||
|
|
||
|
KEY_PATH=$(echo "/zitadel/$(dirname ${ZITADEL_KEY_PATH})")
|
||
|
KEY_FILE=${KEY_PATH}/local_keys.yaml
|
||
|
|
||
|
mkdir -p ${KEY_PATH}
|
||
|
if [ ! -f ${KEY_FILE} ]; then
|
||
|
touch ${KEY_FILE}
|
||
|
fi
|
||
|
|
||
|
for key in $(env | grep "ZITADEL_.*_KEY" | cut -d'=' -f2); do
|
||
|
if [ $(grep -L ${key} ${KEY_FILE}) ]; then
|
||
|
echo "create key for ${key} in ${KEY_FILE}"
|
||
|
echo -e "${key}: $(head -c22 /dev/urandom | base64)" >> ${KEY_FILE}
|
||
|
fi
|
||
|
done
|