summary refs log tree commit diff
path: root/nixos/modules/services/web-apps
diff options
context:
space:
mode:
authortalyz <kim.lindberger@gmail.com>2021-04-15 13:20:22 +0200
committertalyz <kim.lindberger@gmail.com>2021-04-16 14:21:01 +0200
commit515fb48312f6cb8e51bf0f24438b0faf92790afd (patch)
tree2b34ddbf8189c751570c0e3949aa7d50f3f7250d /nixos/modules/services/web-apps
parent2db1ae068d6eba2a7aa028167ac62ecd076477b4 (diff)
downloadnixpkgs-515fb48312f6cb8e51bf0f24438b0faf92790afd.tar
nixpkgs-515fb48312f6cb8e51bf0f24438b0faf92790afd.tar.gz
nixpkgs-515fb48312f6cb8e51bf0f24438b0faf92790afd.tar.bz2
nixpkgs-515fb48312f6cb8e51bf0f24438b0faf92790afd.tar.lz
nixpkgs-515fb48312f6cb8e51bf0f24438b0faf92790afd.tar.xz
nixpkgs-515fb48312f6cb8e51bf0f24438b0faf92790afd.tar.zst
nixpkgs-515fb48312f6cb8e51bf0f24438b0faf92790afd.zip
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.
Diffstat (limited to 'nixos/modules/services/web-apps')
-rw-r--r--nixos/modules/services/web-apps/discourse.nix6
1 files changed, 4 insertions, 2 deletions
diff --git a/nixos/modules/services/web-apps/discourse.nix b/nixos/modules/services/web-apps/discourse.nix
index 03ea002c9de..38ca08c4759 100644
--- a/nixos/modules/services/web-apps/discourse.nix
+++ b/nixos/modules/services/web-apps/discourse.nix
@@ -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' \