fix(#16): Secrets-Management für Unraid implementiert
Some checks are pending
Docker Test / test (push) Waiting to run
Some checks are pending
Docker Test / test (push) Waiting to run
This commit is contained in:
parent
bbeea75b00
commit
1f831a6edc
3 changed files with 72 additions and 1 deletions
35
scripts/preflight-check.js
Normal file
35
scripts/preflight-check.js
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// Load .env file
|
||||
const envPath = path.join(__dirname, '../backend/.env');
|
||||
if (!fs.existsSync(envPath)) {
|
||||
console.error('Fehler: .env Datei nicht gefunden.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const envContent = fs.readFileSync(envPath, 'utf8');
|
||||
const envVars = {};
|
||||
envContent.split('\n').forEach(line => {
|
||||
if (line.trim() && !line.startsWith('#')) {
|
||||
const [key, value] = line.split('=');
|
||||
envVars[key.trim()] = value ? value.trim() : '';
|
||||
}
|
||||
});
|
||||
|
||||
// Check required secrets
|
||||
const requiredSecrets = ['DB_PASSWORD', 'JWT_SECRET', 'DATA_ENCRYPTION_KEY'];
|
||||
let allPresent = true;
|
||||
|
||||
requiredSecrets.forEach(secret => {
|
||||
if (!envVars[secret] || envVars[secret] === 'change-me' || envVars[secret] === '') {
|
||||
console.error(`Fehler: Pflicht-Secret '${secret}' nicht gesetzt oder auf 'change-me' gesetzt.`);
|
||||
allPresent = false;
|
||||
}
|
||||
});
|
||||
|
||||
if (!allPresent) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log('Alle Pflicht-Secrets sind vorhanden.');
|
||||
Loading…
Add table
Add a link
Reference in a new issue