[improve] do not ask useless info during docker install
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user