Merge pull request #138852 from ryantm/dev/ryantm/discourse-skip-create

nixos/discourse: add discourse.admin.skipCreate option

authored by Kim Lindberger and committed by GitHub 3d3b1a70 c93472b0

+20 -6
+20 -6
nixos/modules/services/web-apps/discourse.nix
··· 172 }; 173 174 admin = { 175 email = lib.mkOption { 176 type = lib.types.str; 177 example = "admin@example.com"; ··· 721 lib.optionalString (file != null) '' 722 replace-secret '${file}' '${file}' /run/discourse/config/discourse.conf 723 ''; 724 in '' 725 set -o errexit -o pipefail -o nounset -o errtrace 726 shopt -s inherit_errexit ··· 750 discourse-rake db:migrate >>/var/log/discourse/db_migration.log 751 chmod -R u+w /run/discourse/tmp/ 752 753 - export ADMIN_EMAIL="${cfg.admin.email}" 754 - export ADMIN_NAME="${cfg.admin.fullName}" 755 - export ADMIN_USERNAME="${cfg.admin.username}" 756 - ADMIN_PASSWORD="$(<${cfg.admin.passwordFile})" 757 - export ADMIN_PASSWORD 758 - discourse-rake admin:create_noninteractively 759 760 discourse-rake themes:update 761 discourse-rake uploads:regenerate_missing_optimized
··· 172 }; 173 174 admin = { 175 + skipCreate = lib.mkOption { 176 + type = lib.types.bool; 177 + default = false; 178 + description = '' 179 + Do not create the admin account, instead rely on other 180 + existing admin accounts. 181 + ''; 182 + }; 183 + 184 email = lib.mkOption { 185 type = lib.types.str; 186 example = "admin@example.com"; ··· 730 lib.optionalString (file != null) '' 731 replace-secret '${file}' '${file}' /run/discourse/config/discourse.conf 732 ''; 733 + 734 + mkAdmin = '' 735 + export ADMIN_EMAIL="${cfg.admin.email}" 736 + export ADMIN_NAME="${cfg.admin.fullName}" 737 + export ADMIN_USERNAME="${cfg.admin.username}" 738 + ADMIN_PASSWORD="$(<${cfg.admin.passwordFile})" 739 + export ADMIN_PASSWORD 740 + discourse-rake admin:create_noninteractively 741 + ''; 742 + 743 in '' 744 set -o errexit -o pipefail -o nounset -o errtrace 745 shopt -s inherit_errexit ··· 769 discourse-rake db:migrate >>/var/log/discourse/db_migration.log 770 chmod -R u+w /run/discourse/tmp/ 771 772 + ${lib.optionalString (!cfg.admin.skipCreate) mkAdmin} 773 774 discourse-rake themes:update 775 discourse-rake uploads:regenerate_missing_optimized