From dfea6ebebce7101a832053873dd21b80c2168407 Mon Sep 17 00:00:00 2001 From: Nareshkumar Rao <_accounts@nareshkumarrao.com> Date: Tue, 27 Jul 2021 17:14:34 +0200 Subject: [PATCH] configurable admin account --- app.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index c0dd951..4c1e8b1 100644 --- a/app.js +++ b/app.js @@ -71,12 +71,12 @@ const User = sequelize.define('User', { }); User.sync().then(() => { - if(!isProduction){ + if(process.env.ADMIN_USERNAME && process.env.ADMIN_PASSWORD){ User.create({ - telegram: "admin", - hash: bcrypt.hashSync("test", 10), + telegram: process.env.ADMIN_USERNAME, + hash: bcrypt.hashSync(process.env.ADMIN_PASSWORD, 10), }).catch(e => { - console.log("Couldn't create demo account. Probably exists."); + console.log("Couldn't create admin account. Probably exists."); }); } });