diff options
Diffstat (limited to 'build/index.js')
-rw-r--r-- | build/index.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/build/index.js b/build/index.js index bfc8b8d..91fdc29 100644 --- a/build/index.js +++ b/build/index.js @@ -6,6 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); const express_1 = __importDefault(require("express")); const hypixel_1 = require("./hypixel"); const app = express_1.default(); +app.use((req, res, next) => { + if (process.env.key && req.headers.key !== process.env.key) + // if a key is set in process.env and the header doesn't match return an error + // TODO: make this have a status code + return res.json({ error: 'Key in header must match key in env' }); + next(); +}); app.get('/', async (req, res) => { res.json({ ok: true }); }); |