feat(relay): Use a simpler hack for credentials (#452)
This commit is contained in:
parent
ecccb211aa
commit
8c053b661a
@ -180,8 +180,9 @@ if [ ! -f "$RELAY_CREDENTIALS_JSON" ]; then
|
|||||||
|
|
||||||
# We need the ugly hack below as `relay generate credentials` tries to read the config and the credentials
|
# 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
|
# even with the `--stdout` and `--overwrite` flags and then errors out when the credentials file exists but
|
||||||
# not valid JSON.
|
# not valid JSON. We hit this case as we redirect output to the same config folder, creating an empty
|
||||||
$dcr --no-deps --entrypoint /bin/bash relay -c "cp /work/.relay/config.yml /tmp/config.yml && /bin/relay --config /tmp credentials generate > /dev/null && cat /tmp/credentials.json" > "$RELAY_CREDENTIALS_JSON"
|
# credentials file before relay runs.
|
||||||
|
$dcr --no-deps -v $(pwd)/$RELAY_CONFIG_YML:/tmp/config.yml relay --config /tmp credentials generate --stdout > "$RELAY_CREDENTIALS_JSON"
|
||||||
CREDENTIALS=$(sed -n 's/^.*"public_key"[[:space:]]*:[[:space:]]*"\([a-zA-Z0-9_-]\{1,\}\)".*$/\1/p' "$RELAY_CREDENTIALS_JSON")
|
CREDENTIALS=$(sed -n 's/^.*"public_key"[[:space:]]*:[[:space:]]*"\([a-zA-Z0-9_-]\{1,\}\)".*$/\1/p' "$RELAY_CREDENTIALS_JSON")
|
||||||
if [ -z "$CREDENTIALS" ]; then
|
if [ -z "$CREDENTIALS" ]; then
|
||||||
>&2 echo "FAIL: Cannot read credentials back from $RELAY_CREDENTIALS_JSON."
|
>&2 echo "FAIL: Cannot read credentials back from $RELAY_CREDENTIALS_JSON."
|
||||||
|
Reference in New Issue
Block a user