mirror of
https://github.com/Retropex/apolloapi-v2.git
synced 2025-05-20 15:10:43 +02:00
Log password generation just to be sure
This commit is contained in:
parent
afb49898b0
commit
14a63e726f
@ -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)
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user