Log password generation just to be sure

This commit is contained in:
Michele Marcucci 2022-07-22 09:57:09 +02:00
parent afb49898b0
commit 14a63e726f
2 changed files with 6 additions and 2 deletions

View File

@ -7,7 +7,6 @@ const { knex } = require('./db')
initEnvFile() initEnvFile()
runMigrations() runMigrations()
runGenerateBitcoinPassword()
.then(startServer) .then(startServer)
async function initEnvFile () { async function initEnvFile () {
@ -32,7 +31,9 @@ async function initEnvFile () {
async function runMigrations () { async function runMigrations () {
try { try {
console.log('Run migrations')
const resp = await knex.migrate.latest() const resp = await knex.migrate.latest()
await runGenerateBitcoinPassword();
} catch (err) { } catch (err) {
console.log(err) console.log(err)
} }
@ -40,9 +41,10 @@ async function runMigrations () {
async function runGenerateBitcoinPassword () { async function runGenerateBitcoinPassword () {
try { try {
console.log('Checking bitcoin password existence')
const [ settings ] = await knex('settings').select(['node_rpc_password as nodeRpcPassword']) const [ settings ] = await knex('settings').select(['node_rpc_password as nodeRpcPassword'])
if (settings && settings.nodeRpcPassword) return if (settings && settings.nodeRpcPassword) return console.log('Bitcoin password found')
else await utils.auth.changeNodeRpcPassword() else await utils.auth.changeNodeRpcPassword()
} catch (err) { } catch (err) {
console.log(err) console.log(err)

View File

@ -23,6 +23,8 @@ module.exports.auth = {
async changeNodeRpcPassword () { async changeNodeRpcPassword () {
try { try {
console.log('Generating and saving bitcoin password')
const password = generator.generate({ const password = generator.generate({
length: 12, length: 12,
numbers: true numbers: true