From 8c053b661af67c1616092d3d9a02f55c029eac07 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Mon, 27 Apr 2020 21:35:59 +0300 Subject: [PATCH] feat(relay): Use a simpler hack for credentials (#452) --- install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 33328c0..e944da3 100755 --- a/install.sh +++ b/install.sh @@ -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 # even with the `--stdout` and `--overwrite` flags and then errors out when the credentials file exists but - # not valid JSON. - $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" + # 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 -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") if [ -z "$CREDENTIALS" ]; then >&2 echo "FAIL: Cannot read credentials back from $RELAY_CREDENTIALS_JSON."