Enabling test server and bug fixes
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
#!/usr/bin/env node
|
||||
import { ServerTool } from './ServerTool'
|
||||
import pino from 'pino'
|
||||
import * as pinoExpress from 'pino-pretty-express'
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import config from 'config'
|
||||
import { ServerTool } from "./ServerTool"
|
||||
import pino from "pino"
|
||||
import * as pinoExpress from "pino-pretty-express"
|
||||
import path from "path"
|
||||
import fs from "fs"
|
||||
import config from "config"
|
||||
|
||||
const serviceName = 'dar-server'
|
||||
const isProduction = (process.env.NODE_ENV == 'production')
|
||||
const serviceName = config.get("serviceName.server")
|
||||
const isProduction = process.env.NODE_ENV === "production"
|
||||
let log = null
|
||||
|
||||
if (isProduction) {
|
||||
log = pino( { name: serviceName },
|
||||
fs.createWriteStream(path.join(config.get('logDir'), serviceName + '.log'))
|
||||
log = pino(
|
||||
{ name: serviceName },
|
||||
fs.createWriteStream(path.join(config.get("logDir"), serviceName + ".log"))
|
||||
)
|
||||
} else {
|
||||
const pretty = pinoExpress.pretty({})
|
||||
@@ -20,10 +21,13 @@ if (isProduction) {
|
||||
log = pino({ name: serviceName }, pretty)
|
||||
}
|
||||
|
||||
const tool = new ServerTool(path.basename(process.argv[1], '.js'), log)
|
||||
const tool = new ServerTool(path.basename(process.argv[1], ".js"), log)
|
||||
|
||||
tool.run(process.argv.slice(2)).then((exitCode) => {
|
||||
process.exitCode = exitCode
|
||||
}).catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
tool
|
||||
.run(process.argv.slice(2))
|
||||
.then((exitCode) => {
|
||||
process.exitCode = exitCode
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user