Some checks failed
Release production image / production-image (push) Has been cancelled
18 lines
872 B
TypeScript
18 lines
872 B
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { validateProductionConfiguration } from './productionConfig';
|
|
|
|
test('development does not require production keys', () => {
|
|
assert.doesNotThrow(() => validateProductionConfiguration({ NODE_ENV: 'development' }));
|
|
});
|
|
|
|
test('production requires both correctly sized persistent keys', () => {
|
|
assert.throws(() => validateProductionConfiguration({ NODE_ENV: 'production' }), /CONDUCTOR_SECRET_KEY/);
|
|
assert.throws(() => validateProductionConfiguration({ NODE_ENV: 'production', CONDUCTOR_SECRET_KEY: '11'.repeat(32) }), /CONDUCTOR_SESSION_KEY/);
|
|
assert.doesNotThrow(() => validateProductionConfiguration({
|
|
NODE_ENV: 'production',
|
|
CONDUCTOR_SECRET_KEY: Buffer.alloc(32, 7).toString('base64'),
|
|
CONDUCTOR_SESSION_KEY: 'session-key-material-that-is-at-least-32-bytes',
|
|
}));
|
|
});
|