Add bypass
This commit is contained in:
parent
0a5b3775a7
commit
16a16d643f
3
index.js
3
index.js
|
|
@ -38,6 +38,9 @@ app.use((req, res, next) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
global.auth = (req, res, next) => {
|
global.auth = (req, res, next) => {
|
||||||
|
if(!process.env.API_KEY) {
|
||||||
|
return next(); // No API key set, allow all requests
|
||||||
|
}
|
||||||
if (process.env.API_KEY && req.headers['Authorization'] === process.env.API_KEY) {
|
if (process.env.API_KEY && req.headers['Authorization'] === process.env.API_KEY) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue