Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/.env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
PORT=5000
MONGO_URI=mongodb://localhost:27017/githubTracker
SESSION_SECRET=your-secret-key
NODE_ENV=development
3 changes: 3 additions & 0 deletions backend/Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ RUN npm install --production
# Copy the rest of the application files
COPY . .

# Set production environment so session cookies get Secure + SameSite=Strict
ENV NODE_ENV=production

# Expose the port for the application
EXPOSE 5000

Expand Down
6 changes: 6 additions & 0 deletions backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ app.use(session({
secret: process.env.SESSION_SECRET,
resave: false,
saveUninitialized: false,
cookie: {
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
sameSite: process.env.NODE_ENV === 'production' ? 'strict' : 'lax',
maxAge: 24 * 60 * 60 * 1000,
},
}));
app.use(passport.initialize());
app.use(passport.session());
Expand Down
Loading