feat: chiffrement AES-256-GCM des secrets + lecture env
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
// server/env.ts
|
||||
function required(name: string): string {
|
||||
const v = process.env[name];
|
||||
if (!v) throw new Error(`Variable d'environnement manquante: ${name}`);
|
||||
return v;
|
||||
}
|
||||
|
||||
export const env = {
|
||||
masterKeyHex: process.env.SU_MASTER_KEY ?? "",
|
||||
dbPath: process.env.SU_DB_PATH ?? "./data/system-update.db",
|
||||
reportsDir: process.env.SU_REPORTS_DIR ?? "./reports",
|
||||
port: Number(process.env.SU_PORT ?? 8787),
|
||||
requireMasterKey(): string {
|
||||
const k = required("SU_MASTER_KEY");
|
||||
if (k.length !== 64) throw new Error("SU_MASTER_KEY doit faire 64 caractères hex (32 octets).");
|
||||
return k;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user