Add better logging/Other stuff #3
2
index.js
2
index.js
|
|
@ -55,7 +55,7 @@ pool.getConnection().then((conn) => {
|
||||||
// delete all users (The big scary one lol)
|
// delete all users (The big scary one lol)
|
||||||
conn.query("DELETE FROM users").then(() => {
|
conn.query("DELETE FROM users").then(() => {
|
||||||
// Generate 32 char random string
|
// Generate 32 char random string
|
||||||
const passwd = crypto.randomBytes(32).toString('hex');
|
const passwd = process.env.SET_ADMIN_PASS || crypto.randomBytes(32).toString('hex');
|
||||||
bcrypt.hash(passwd, 10).then((hash) => {
|
bcrypt.hash(passwd, 10).then((hash) => {
|
||||||
conn.query("INSERT INTO users (id, username, passwordHash) VALUES (1, 'admin', ?)",
|
conn.query("INSERT INTO users (id, username, passwordHash) VALUES (1, 'admin', ?)",
|
||||||
[hash]).then(() => {
|
[hash]).then(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue