fix: move secret to .env

This commit is contained in:
Riccardo
2024-07-20 18:17:57 +02:00
parent 198e77e1dd
commit ea2d6d8f48
2 changed files with 7 additions and 2 deletions

View File

@@ -1 +1,2 @@
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
SECRET=

View File

@@ -8,6 +8,10 @@ import { fromZodError } from 'zod-validation-error';
import { addition } from '../utils/addition';
import { logger } from '../utils/logger';
if (!process.env.SECRET) {
throw new Error('SECRET environment variable is required');
}
const limiter = rateLimit({
windowMs: 10 * 60 * 1000,
max: 50,
@@ -22,7 +26,7 @@ server.disable('x-powered-by');
server.set('trust proxy', 1);
server.use(
session({
secret: 's3Cur3',
secret: process.env.SECRET,
name: 'sessionId'
})
);