Merge current features with security hardening and automatic safe initialization
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
const file = process.env.APP_DATABASE_PASSWORD_FILE;
|
||||
if (!file) throw new Error('Runtime password file is required.');
|
||||
const password = readFileSync(file, 'utf8').trim();
|
||||
if (!/^[a-f0-9]{64}$/.test(password)) throw new Error('Invalid runtime password file.');
|
||||
const url = new URL('postgresql://kita_runtime@postgres:5432/' + encodeURIComponent(process.env.APP_DATABASE_NAME || 'kita_planer'));
|
||||
url.password = password;
|
||||
process.stdout.write(url.toString());
|
||||
Reference in New Issue
Block a user