[improve] do not ask useless info during docker install

This commit is contained in:
les
2019-09-25 19:07:15 +02:00
parent 297e070801
commit be20ac53de
3 changed files with 116 additions and 92 deletions

View File

@@ -19,20 +19,24 @@ module.exports = {
config.admin_email = admin.email
config.db.logging = false
consola.info(`Save configuration to ${config_path}`)
fs.writeFileSync(config_path, JSON.stringify(config, null, 2))
try {
fs.writeFileSync(config_path, JSON.stringify(config, null, 2))
} catch(e) {
consola.warn(` ⚠️ ${e}. You can specify configuration path using '--config'`)
}
// sync db
const db = require('./api/models')
try {
await db.user.findAll()
consola.warn(`⚠️ Non empty db! Please move your current db elsewhere than retry.`)
consola.warn(` Non empty db! Please move your current db elsewhere than retry.`)
return false
} catch (e) { }
consola.info(`Create tables schema`)
await db.sequelize.sync().catch(e => {
consola.error('Error creating tables', e)
consola.error(' Error creating tables', e)
return false
})
@@ -68,5 +72,7 @@ module.exports = {
// close db connection
await db.sequelize.close()
return true
}
}