Merge staging-next-21.05 into staging-21.05

This commit is contained in:
github-actions[bot] 2021-09-24 18:02:54 +00:00 committed by GitHub
commit 72e691ca4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 6 deletions

View File

@ -172,6 +172,15 @@ in
}; };
admin = { admin = {
skipCreate = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Do not create the admin account, instead rely on other
existing admin accounts.
'';
};
email = lib.mkOption { email = lib.mkOption {
type = lib.types.str; type = lib.types.str;
example = "admin@example.com"; example = "admin@example.com";
@ -721,6 +730,16 @@ in
lib.optionalString (file != null) '' lib.optionalString (file != null) ''
replace-secret '${file}' '${file}' /run/discourse/config/discourse.conf replace-secret '${file}' '${file}' /run/discourse/config/discourse.conf
''; '';
mkAdmin = ''
export ADMIN_EMAIL="${cfg.admin.email}"
export ADMIN_NAME="${cfg.admin.fullName}"
export ADMIN_USERNAME="${cfg.admin.username}"
ADMIN_PASSWORD="$(<${cfg.admin.passwordFile})"
export ADMIN_PASSWORD
discourse-rake admin:create_noninteractively
'';
in '' in ''
set -o errexit -o pipefail -o nounset -o errtrace set -o errexit -o pipefail -o nounset -o errtrace
shopt -s inherit_errexit shopt -s inherit_errexit
@ -750,12 +769,7 @@ in
discourse-rake db:migrate >>/var/log/discourse/db_migration.log discourse-rake db:migrate >>/var/log/discourse/db_migration.log
chmod -R u+w /run/discourse/tmp/ chmod -R u+w /run/discourse/tmp/
export ADMIN_EMAIL="${cfg.admin.email}" ${lib.optionalString (!cfg.admin.skipCreate) mkAdmin}
export ADMIN_NAME="${cfg.admin.fullName}"
export ADMIN_USERNAME="${cfg.admin.username}"
ADMIN_PASSWORD="$(<${cfg.admin.passwordFile})"
export ADMIN_PASSWORD
discourse-rake admin:create_noninteractively
discourse-rake themes:update discourse-rake themes:update
discourse-rake uploads:regenerate_missing_optimized discourse-rake uploads:regenerate_missing_optimized