git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commit515fb48312f6cb8e51bf0f24438b0faf92790afd authortalyz <kim.lindberger@gmail.com> dateThu 15 Apr 2021, 13:20 (6 years ago) parent2db1ae0
1 file changed+4−2
nixos/modules/services/web-apps/discourse.nix+4−2
nixos/modules/services/web-apps/discourse.nix+4−2
@@ -726,7 +726,8 @@ in
726726 export ADMIN_EMAIL="${cfg.admin.email}"
727727 export ADMIN_NAME="${cfg.admin.fullName}"
728728 export ADMIN_USERNAME="${cfg.admin.username}"
729− export ADMIN_PASSWORD="$(<${cfg.admin.passwordFile})"
729+ ADMIN_PASSWORD="$(<${cfg.admin.passwordFile})"
730+ export ADMIN_PASSWORD
730731 discourse-rake admin:create_noninteractively
731732
732733 discourse-rake themes:update
@@ -938,7 +939,8 @@ in
938939 set -o errexit -o pipefail -o nounset -o errtrace
939940 shopt -s inherit_errexit
940941
941− export api_key=$(<'${apiKeyPath}')
942+ api_key=$(<'${apiKeyPath}')
943+ export api_key
942944
943945 jq <${mail-receiver-json} \
944946 '.DISCOURSE_API_KEY = $ENV.api_key' \