Beta and env changes
This commit is contained in:
21
backend/middleware/betaAuth.js
Normal file
21
backend/middleware/betaAuth.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const verifyBetaPassword = (req, res, next) => {
|
||||
const betaPassword = req.headers['x-beta-password'];
|
||||
const configuredPassword = process.env.BETA_PASSWORD;
|
||||
|
||||
if (!configuredPassword) {
|
||||
console.error('BETA_PASSWORD environment variable is not set');
|
||||
return res.status(500).json({ error: 'Beta password not configured on server' });
|
||||
}
|
||||
|
||||
if (!betaPassword) {
|
||||
return res.status(401).json({ error: 'Beta password required' });
|
||||
}
|
||||
|
||||
if (betaPassword !== configuredPassword) {
|
||||
return res.status(403).json({ error: 'Invalid beta password' });
|
||||
}
|
||||
|
||||
next();
|
||||
};
|
||||
|
||||
module.exports = { verifyBetaPassword };
|
||||
Reference in New Issue
Block a user