X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server.ts;h=66dcb3c400cb584df8a342f245785219b4960e84;hb=5f46d28ccac4a20fcbb12c96a047a84a08e485ae;hp=f2e589243aab5ec4ca9f3b17f440184afdd94ecf;hpb=2d53be0267acc49cda46707b885096193a1f4e9c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server.ts b/server.ts index f2e589243..66dcb3c40 100644 --- a/server.ts +++ b/server.ts @@ -20,7 +20,7 @@ import * as cli from 'commander' process.title = 'peertube' // Create our main app -const app = express() +const app = express().disable("x-powered-by") // ----------- Core checker ----------- import { checkMissedConfig, checkFFmpeg, checkNodeVersion } from './server/initializers/checker-before-init' @@ -158,7 +158,8 @@ morgan.token('user-agent', (req: express.Request) => { return req.get('user-agent') }) app.use(morgan('combined', { - stream: { write: logger.info.bind(logger) } + stream: { write: logger.info.bind(logger) }, + skip: req => CONFIG.LOG.LOG_PING_REQUESTS === false && req.originalUrl === '/api/v1/ping' })) // For body requests @@ -204,7 +205,8 @@ app.use('/', staticRouter) app.use('/', lazyStaticRouter) // Client files, last valid routes! -if (cli.client) app.use('/', clientsRouter) +const cliOptions = cli.opts() +if (cliOptions.client) app.use('/', clientsRouter) // ----------- Errors ----------- @@ -249,7 +251,7 @@ async function startApplication () { Emailer.Instance.init() await Promise.all([ - Emailer.Instance.checkConnectionOrDie(), + Emailer.Instance.checkConnection(), JobQueue.Instance.init() ]) @@ -276,14 +278,14 @@ async function startApplication () { updateStreamingPlaylistsInfohashesIfNeeded() .catch(err => logger.error('Cannot update streaming playlist infohashes.', { err })) - if (cli.plugins) await PluginManager.Instance.registerPluginsAndThemes() + if (cliOptions.plugins) await PluginManager.Instance.registerPluginsAndThemes() LiveManager.Instance.init() if (CONFIG.LIVE.ENABLED) LiveManager.Instance.run() // Make server listening server.listen(port, hostname, () => { - logger.info('Server listening on %s:%d', hostname, port) + logger.info('HTTP server listening on %s:%d', hostname, port) logger.info('Web server: %s', WEBSERVER.URL) Hooks.runAction('action:application.listening')