mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
bring back sw stats
This commit is contained in:
@@ -1,9 +1,22 @@
|
|||||||
import express from 'express';
|
import express from 'express';
|
||||||
|
import swStats from 'swagger-stats';
|
||||||
import serverless from './serverless.js';
|
import serverless from './serverless.js';
|
||||||
|
import { manifest } from './lib/manifest.js';
|
||||||
import { initBestTrackers } from './lib/magnetHelper.js';
|
import { initBestTrackers } from './lib/magnetHelper.js';
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
app.enable('trust proxy');
|
app.enable('trust proxy');
|
||||||
|
app.use(swStats.getMiddleware({
|
||||||
|
name: manifest().name,
|
||||||
|
version: manifest().version,
|
||||||
|
timelineBucketDuration: 60 * 60 * 1000,
|
||||||
|
apdexThreshold: 100,
|
||||||
|
authentication: true,
|
||||||
|
onAuthenticate: (req, username, password) => {
|
||||||
|
return username === process.env.METRICS_USER
|
||||||
|
&& password === process.env.METRICS_PASSWORD
|
||||||
|
},
|
||||||
|
}))
|
||||||
app.use(express.static('static', { maxAge: '1y' }));
|
app.use(express.static('static', { maxAge: '1y' }));
|
||||||
app.use((req, res, next) => serverless(req, res, next));
|
app.use((req, res, next) => serverless(req, res, next));
|
||||||
app.listen(process.env.PORT || 7000, () => {
|
app.listen(process.env.PORT || 7000, () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user