nixos/discourse: Fail on file errors

Bash doesn't handle subshell errors properly if the result is used as
input to a command. To cause the services to fail when the files can't
be read, we need to assign the value to a variable, then export it
separately.
This commit is contained in:
talyz 2021-04-15 13:20:22 +02:00
parent 2db1ae068d
commit 515fb48312
No known key found for this signature in database
GPG Key ID: 2DED2151F4671A2B

View File

@ -726,7 +726,8 @@ in
export ADMIN_EMAIL="${cfg.admin.email}"
export ADMIN_NAME="${cfg.admin.fullName}"
export ADMIN_USERNAME="${cfg.admin.username}"
export ADMIN_PASSWORD="$(<${cfg.admin.passwordFile})"
ADMIN_PASSWORD="$(<${cfg.admin.passwordFile})"
export ADMIN_PASSWORD
discourse-rake admin:create_noninteractively
discourse-rake themes:update
@ -938,7 +939,8 @@ in
set -o errexit -o pipefail -o nounset -o errtrace
shopt -s inherit_errexit
export api_key=$(<'${apiKeyPath}')
api_key=$(<'${apiKeyPath}')
export api_key
jq <${mail-receiver-json} \
'.DISCOURSE_API_KEY = $ENV.api_key' \