Environment Config
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import passport from "passport";
|
||||
import session from "express-session";
|
||||
import { initialize } from "./passport-config";
|
||||
import auth from "../routes/auth/auth-controller";
|
||||
import { Express } from "express";
|
||||
|
||||
export function connect(app: Express) {
|
||||
app.use(session({
|
||||
secret: process.env.SESSION_SECRET || "default-secret",
|
||||
resave: false,
|
||||
saveUninitialized: false
|
||||
}));
|
||||
|
||||
app.use(passport.initialize());
|
||||
app.use(passport.authenticate(['headerapikey', 'session'], {
|
||||
session: false, // Only set a session on the login request.
|
||||
}));
|
||||
|
||||
initialize(passport);
|
||||
|
||||
app.use("/auth", auth);
|
||||
}
|
||||
Reference in New Issue
Block a user