fix: absent SSH_AUTHORIZED_KEY does not cause failure

This commit is contained in:
Alexander Tomokhov 2023-12-28 20:00:44 +04:00
parent 4920434aec
commit 15f36551ad

View file

@ -30,9 +30,11 @@ readonly NIX_OPTS=(--extra-experimental-features "nix-command flakes")
DoNetConf=
genOptionalSsh() {
[ -n "${SSH_AUTHORIZED_KEY}" ] && cat << EOF
if [ -n "${SSH_AUTHORIZED_KEY}" ]; then
cat << EOF
"ssh": { "rootKeys": [ "${SSH_AUTHORIZED_KEY}" ] },
EOF
fi
}
# TODO receive disk device path from outside
@ -528,8 +530,6 @@ set -o xtrace
shopt -s inherit_errexit
trap 'echo ${LINENO}: "$BASH_COMMAND"; exit 1' ERR
genNetworkingConf
# digitalocean requires detailed network config to be generated
[ "$PROVIDER" == "digitalocean" ] && DoNetConf="y"