mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 10:34:17 +00:00
forge to use morgan
This commit is contained in:
parent
96d129282a
commit
8a1d03ce6c
@ -1,10 +1,13 @@
|
||||
const path = require("path")
|
||||
const fs = require("fs")
|
||||
const net = require("corenode/net")
|
||||
|
||||
const experimentalFlag = path.resolve(module.path, "../../.experimental")
|
||||
const packageJSON = require(path.resolve(module.path, "../../package.json"))
|
||||
const moduleAlias = require("module-alias")
|
||||
|
||||
// set globals variables
|
||||
global.LINEBRIDGE_SERVER_EXPERIMENTAL = fs.existsSync(experimentalFlag)
|
||||
global.LINEBRIDGE_SERVER_VERSION = packageJSON.version
|
||||
|
||||
global.LOCALHOST_ADDRESS = net.ip.getHostAddress() ?? "localhost"
|
||||
@ -48,12 +51,9 @@ global.DEFAULT_MIDDLEWARES = [
|
||||
"preflightContinue": false,
|
||||
"optionsSuccessStatus": 204
|
||||
}),
|
||||
require("morgan")(process.env.MORGAN_FORMAT ?? ":method :status :url - :response-time ms")
|
||||
]
|
||||
|
||||
if (process.env.LOG_REQUESTS === "true") {
|
||||
global.DEFAULT_MIDDLEWARES.push(require("morgan")(process.env.MORGAN_FORMAT ?? ":method :url :status - :response-time ms"))
|
||||
}
|
||||
|
||||
// patches
|
||||
const { Buffer } = require("buffer")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user