self-hosted/install/relay-credentials.sh
Chad Whitacre da8f4903e4
Revert "Add CI compose version 1.29.2 / 2.0.1 / 2.2.3 (#1251)" (#1272)
This reverts commit 3abbb3e8bd3a4d1d2ecbdb0f4fb255507c55aca0.
2022-01-24 16:36:14 -05:00

26 lines
858 B
Bash

echo "${_group}Generating Relay credentials ..."
RELAY_CONFIG_YML="../relay/config.yml"
RELAY_CREDENTIALS_JSON="../relay/credentials.json"
ensure_file_from_example $RELAY_CONFIG_YML
if [[ ! -f "$RELAY_CREDENTIALS_JSON" ]]; then
# We need the ugly hack below as `relay generate credentials` tries to read
# the config and the credentials even with the `--stdout` and `--overwrite`
# flags and then errors out when the credentials file exists but not valid
# JSON. We hit this case as we redirect output to the same config folder,
# creating an empty credentials file before relay runs.
$dcr \
--no-deps \
--volume "$(pwd)/$RELAY_CONFIG_YML:/tmp/config.yml" \
relay --config /tmp credentials generate --stdout \
> "$RELAY_CREDENTIALS_JSON"
echo "Relay credentials written to $RELAY_CREDENTIALS_JSON"
fi
echo "${_endgroup}"