From 1d19c29bb07e493405fafc31ff5085e2c642baf4 Mon Sep 17 00:00:00 2001 From: David Lievrouw Date: Mon, 3 Jun 2024 13:32:23 +0200 Subject: [PATCH 1/2] Read initial admin email and password from env vars. --- backend/setup.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/setup.js b/backend/setup.js index 7a138fe5..4b304135 100644 --- a/backend/setup.js +++ b/backend/setup.js @@ -21,11 +21,13 @@ const setupDefaultUser = () => { .then((row) => { if (!row.count) { // Create a new user and set password + let email = process.env.INITIAL_ADMIN_EMAIL || 'admin@example.com'; + let password = process.env.INITIAL_ADMIN_PASSWORD || 'changeme'; logger.info('Creating a new user: admin@example.com with password: changeme'); let data = { is_deleted: 0, - email: 'admin@example.com', + email: email, name: 'Administrator', nickname: 'Admin', avatar: '', @@ -41,7 +43,7 @@ const setupDefaultUser = () => { .insert({ user_id: user.id, type: 'password', - secret: 'changeme', + secret: password, meta: {}, }) .then(() => { From d66e4e03e6044a13c450f68c9e2ce14db7540e93 Mon Sep 17 00:00:00 2001 From: David Lievrouw Date: Mon, 3 Jun 2024 13:44:08 +0200 Subject: [PATCH 2/2] #3790 Attempt to make ci happy. --- backend/setup.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/setup.js b/backend/setup.js index 4b304135..9a7b6970 100644 --- a/backend/setup.js +++ b/backend/setup.js @@ -21,9 +21,10 @@ const setupDefaultUser = () => { .then((row) => { if (!row.count) { // Create a new user and set password - let email = process.env.INITIAL_ADMIN_EMAIL || 'admin@example.com'; + let email = process.env.INITIAL_ADMIN_EMAIL || 'admin@example.com'; let password = process.env.INITIAL_ADMIN_PASSWORD || 'changeme'; - logger.info('Creating a new user: admin@example.com with password: changeme'); + + logger.info('Creating a new user: ' + email + ' with password: ' + password); let data = { is_deleted: 0,