feat: persistent session cookies (30d sliding) — nanodrop tier #4
@@ -2,7 +2,6 @@ export interface Config {
|
|||||||
port: number;
|
port: number;
|
||||||
host: string;
|
host: string;
|
||||||
jwtSecret: string;
|
jwtSecret: string;
|
||||||
jwtExpiry: string;
|
|
||||||
dbPath: string;
|
dbPath: string;
|
||||||
uploadDir: string;
|
uploadDir: string;
|
||||||
logFile: string;
|
logFile: string;
|
||||||
@@ -28,7 +27,6 @@ export function loadConfig(): Config {
|
|||||||
port: parseInt(process.env.PORT ?? '3000', 10),
|
port: parseInt(process.env.PORT ?? '3000', 10),
|
||||||
host: process.env.HOST ?? '0.0.0.0',
|
host: process.env.HOST ?? '0.0.0.0',
|
||||||
jwtSecret,
|
jwtSecret,
|
||||||
jwtExpiry: process.env.JWT_EXPIRY ?? '7d',
|
|
||||||
dbPath: process.env.DB_PATH ?? './data/nanodrop.db',
|
dbPath: process.env.DB_PATH ?? './data/nanodrop.db',
|
||||||
uploadDir: process.env.UPLOAD_DIR ?? './data/uploads',
|
uploadDir: process.env.UPLOAD_DIR ?? './data/uploads',
|
||||||
logFile: process.env.LOG_FILE ?? './data/nanodrop.log',
|
logFile: process.env.LOG_FILE ?? './data/nanodrop.log',
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ export function createTestApp(overrides: Partial<Config> = {}): TestContext {
|
|||||||
port: 0,
|
port: 0,
|
||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
jwtSecret: 'test-secret-key',
|
jwtSecret: 'test-secret-key',
|
||||||
jwtExpiry: '1h',
|
|
||||||
dbPath: ':memory:',
|
dbPath: ':memory:',
|
||||||
uploadDir,
|
uploadDir,
|
||||||
logFile,
|
logFile,
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ describe('config', () => {
|
|||||||
process.env.JWT_SECRET = 'test-secret';
|
process.env.JWT_SECRET = 'test-secret';
|
||||||
delete process.env.PORT;
|
delete process.env.PORT;
|
||||||
delete process.env.HOST;
|
delete process.env.HOST;
|
||||||
delete process.env.JWT_EXPIRY;
|
|
||||||
delete process.env.DB_PATH;
|
delete process.env.DB_PATH;
|
||||||
delete process.env.UPLOAD_DIR;
|
delete process.env.UPLOAD_DIR;
|
||||||
delete process.env.LOG_FILE;
|
delete process.env.LOG_FILE;
|
||||||
@@ -35,7 +34,6 @@ describe('config', () => {
|
|||||||
|
|
||||||
expect(config.port).toBe(3000);
|
expect(config.port).toBe(3000);
|
||||||
expect(config.host).toBe('0.0.0.0');
|
expect(config.host).toBe('0.0.0.0');
|
||||||
expect(config.jwtExpiry).toBe('7d');
|
|
||||||
expect(config.dbPath).toBe('./data/nanodrop.db');
|
expect(config.dbPath).toBe('./data/nanodrop.db');
|
||||||
expect(config.uploadDir).toBe('./data/uploads');
|
expect(config.uploadDir).toBe('./data/uploads');
|
||||||
expect(config.logFile).toBe('./data/nanodrop.log');
|
expect(config.logFile).toBe('./data/nanodrop.log');
|
||||||
@@ -55,7 +53,6 @@ describe('config', () => {
|
|||||||
process.env.JWT_SECRET = 'my-secret';
|
process.env.JWT_SECRET = 'my-secret';
|
||||||
process.env.PORT = '4000';
|
process.env.PORT = '4000';
|
||||||
process.env.HOST = '127.0.0.1';
|
process.env.HOST = '127.0.0.1';
|
||||||
process.env.JWT_EXPIRY = '1d';
|
|
||||||
process.env.COOKIE_SECURE = 'true';
|
process.env.COOKIE_SECURE = 'true';
|
||||||
process.env.TRUST_PROXY = 'true';
|
process.env.TRUST_PROXY = 'true';
|
||||||
process.env.MAX_FILE_SIZE = '52428800';
|
process.env.MAX_FILE_SIZE = '52428800';
|
||||||
@@ -66,7 +63,6 @@ describe('config', () => {
|
|||||||
expect(config.port).toBe(4000);
|
expect(config.port).toBe(4000);
|
||||||
expect(config.host).toBe('127.0.0.1');
|
expect(config.host).toBe('127.0.0.1');
|
||||||
expect(config.jwtSecret).toBe('my-secret');
|
expect(config.jwtSecret).toBe('my-secret');
|
||||||
expect(config.jwtExpiry).toBe('1d');
|
|
||||||
expect(config.cookieSecure).toBe(true);
|
expect(config.cookieSecure).toBe(true);
|
||||||
expect(config.trustProxy).toBe(true);
|
expect(config.trustProxy).toBe(true);
|
||||||
expect(config.maxFileSize).toBe(52428800);
|
expect(config.maxFileSize).toBe(52428800);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ function makeConfig(overrides: Partial<Config> = {}): Config {
|
|||||||
port: 0,
|
port: 0,
|
||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
jwtSecret: 'x',
|
jwtSecret: 'x',
|
||||||
jwtExpiry: '1h',
|
|
||||||
dbPath: ':memory:',
|
dbPath: ':memory:',
|
||||||
uploadDir: '/tmp',
|
uploadDir: '/tmp',
|
||||||
logFile: '/tmp/x.log',
|
logFile: '/tmp/x.log',
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ function makeConfig(overrides: Partial<Config> = {}): Config {
|
|||||||
port: 0,
|
port: 0,
|
||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
jwtSecret: 'x',
|
jwtSecret: 'x',
|
||||||
jwtExpiry: '1h',
|
|
||||||
dbPath: ':memory:',
|
dbPath: ':memory:',
|
||||||
uploadDir: '/tmp',
|
uploadDir: '/tmp',
|
||||||
logFile: '/tmp/x.log',
|
logFile: '/tmp/x.log',
|
||||||
|
|||||||
Reference in New Issue
Block a user