remove old startup files
This commit is contained in:
parent
868d08398b
commit
893da4c9d2
3 changed files with 0 additions and 161 deletions
|
@ -1,45 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
const pkg = require('../package.json')
|
||||
const path = require('path')
|
||||
|
||||
process.env.cwd = path.resolve('./')
|
||||
|
||||
// needed by nuxt
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
process.chdir(path.resolve(__dirname, '..'))
|
||||
}
|
||||
|
||||
async function start () {
|
||||
const suffix = require('../package.json').name.includes('-edge') ? '-edge' : ''
|
||||
require('@nuxt/cli' + suffix).run(['start', '--modern'])
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
process.exit(2)
|
||||
})
|
||||
}
|
||||
|
||||
console.info(`📅 ${pkg.name} - v${pkg.version} - ${pkg.description} (nodejs: ${process.version}, ENV: ${process.env.NODE_ENV})`)
|
||||
|
||||
require('yargs')
|
||||
.usage('Usage $0 <command> [options]')
|
||||
.option('docker', {
|
||||
alias: 'd',
|
||||
describe: 'Inside docker',
|
||||
default: false,
|
||||
type: 'boolean'
|
||||
})
|
||||
.option('config', {
|
||||
alias: 'c',
|
||||
describe: 'Configuration file',
|
||||
default: path.resolve(process.env.cwd, 'config.json')
|
||||
})
|
||||
.coerce('config', config_path => {
|
||||
const absolute_config_path = path.resolve(process.env.cwd, config_path)
|
||||
process.env.config_path = absolute_config_path
|
||||
return absolute_config_path
|
||||
})
|
||||
.command(['start', 'run', '$0'], 'Start gancio', {}, start)
|
||||
.help('h')
|
||||
.alias('h', 'help')
|
||||
.epilog('Made with ❤ by underscore hacklab - https://gancio.org')
|
||||
.argv
|
|
@ -1,62 +0,0 @@
|
|||
// // check config.js existance
|
||||
// const fs = require('fs')
|
||||
|
||||
// module.exports = {
|
||||
// check (config_path) {
|
||||
// const ret = !fs.existsSync(config_path)
|
||||
// log.warn(`check firstrun: ${ret} - ${config_path}`)
|
||||
// return ret
|
||||
// },
|
||||
|
||||
// async setup (config, config_path) {
|
||||
// // generate a random salt
|
||||
// // consola.info('Generate random salt')
|
||||
// // config.secret = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15)
|
||||
|
||||
// // do not save admin's password in config file
|
||||
// const admin = { email: config.admin.email, password: config.admin.password }
|
||||
// delete config.admin
|
||||
|
||||
// if (config.smtp_type === 'sendmail') {
|
||||
// config.smtp = {
|
||||
// sendmail: true,
|
||||
// newline: 'unix',
|
||||
// path: config.smtp.path
|
||||
// }
|
||||
// }
|
||||
// delete config.smtp_type
|
||||
// delete config.smtp_need_auth
|
||||
// config.admin_email = admin.email
|
||||
// config.db.logging = false
|
||||
// config.log_level = 'debug'
|
||||
// console.info(`Save configuration to ${config_path}`)
|
||||
// try {
|
||||
// fs.writeFileSync(config_path, JSON.stringify(config, null, 2))
|
||||
// } catch (e) {
|
||||
// console.warn(` ⚠️ ${e}. You can specify configuration path using '--config'`)
|
||||
// }
|
||||
|
||||
// // sync db
|
||||
// const db = require('./api/models/index')
|
||||
// const User = require('./api/models/user')
|
||||
// const users = await User.findAll()
|
||||
// if (users.length) {
|
||||
// console.warn(' ⚠ Non empty db! Please move your current db elsewhere than retry.')
|
||||
// return false
|
||||
// }
|
||||
|
||||
// // create admin user
|
||||
// console.info(`Create admin with email: ${admin.email}`)
|
||||
// await User.create({
|
||||
// email: admin.email,
|
||||
// password: admin.password,
|
||||
// is_admin: true,
|
||||
// is_active: true
|
||||
// })
|
||||
|
||||
// // close db connection
|
||||
// await db.close()
|
||||
|
||||
// return true
|
||||
// }
|
||||
// }
|
|
@ -1,54 +0,0 @@
|
|||
const { Nuxt, Builder } = require('nuxt')
|
||||
|
||||
// Import and Set Nuxt.js options
|
||||
const nuxtConfig = require('../nuxt.config.js')
|
||||
const config = require('./config')
|
||||
const log = require('./log')
|
||||
|
||||
async function main () {
|
||||
nuxtConfig.server = config.server
|
||||
|
||||
// Init Nuxt.js
|
||||
if (!nuxtConfig.dev) {
|
||||
nuxtConfig.buildModules = []
|
||||
}
|
||||
const nuxt = new Nuxt(nuxtConfig)
|
||||
|
||||
// Build only in dev mode
|
||||
if (nuxtConfig.dev) {
|
||||
const builder = new Builder(nuxt)
|
||||
await builder.build()
|
||||
} else {
|
||||
await nuxt.ready()
|
||||
}
|
||||
|
||||
try {
|
||||
await nuxt.listen()
|
||||
} catch (e) {
|
||||
log.error({ message: e.message })
|
||||
return
|
||||
}
|
||||
|
||||
let TaskManager
|
||||
if (!config.firstrun) {
|
||||
TaskManager = require('./taskManager').TaskManager
|
||||
TaskManager.start()
|
||||
}
|
||||
const msg = `Listen on ${config.server.host}:${config.server.port} , visit me here => ${config.baseurl}`
|
||||
log.info(msg)
|
||||
|
||||
// close connections/port/unix socket
|
||||
function shutdown () {
|
||||
if (TaskManager) { TaskManager.stop() }
|
||||
nuxt.close(async () => {
|
||||
log.info('Closing DB')
|
||||
const sequelize = require('./api/models')
|
||||
await sequelize.close()
|
||||
process.exit()
|
||||
})
|
||||
}
|
||||
process.on('SIGTERM', shutdown)
|
||||
process.on('SIGINT', shutdown)
|
||||
}
|
||||
|
||||
main()
|
Loading…
Reference in a new issue