Fix healthchecks: install curl in backend and frontend images
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
const passport = require('passport');
|
||||
const JwtStrategy = require('passport-jwt').Strategy;
|
||||
const ExtractJwt = require('passport-jwt').ExtractJwt;
|
||||
const User = require('../models/User');
|
||||
|
||||
const opts = {
|
||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||
secretOrKey: process.env.JWT_SECRET || 'dev_secret_change_in_production',
|
||||
};
|
||||
|
||||
passport.use(new JwtStrategy(opts, async (jwt_payload, done) => {
|
||||
try {
|
||||
const user = await User.findByPk(jwt_payload.id);
|
||||
if (user) {
|
||||
return done(null, user);
|
||||
}
|
||||
return done(null, false);
|
||||
} catch (err) {
|
||||
return done(err, false);
|
||||
}
|
||||
}));
|
||||
|
||||
module.exports = passport;
|
||||
Reference in New Issue
Block a user