Skip to content

Commit d301d57

Browse files
authored
Merge pull request #1167 from Sim-sat/fix-1165
2 parents 014a0e1 + e5915cf commit d301d57

3 files changed

Lines changed: 17 additions & 7 deletions

File tree

SparkyFitnessServer/SparkyFitnessServer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import './env.js'; // Diese Zeile MUSS ganz oben stehen
21
import path from 'path';
32

43
import fs from 'fs';
Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,26 @@ import { loadSecrets } from './utils/secretLoader.js';
55
import { runPreflightChecks } from './utils/preflightChecks.js';
66

77
const __dirname = path.dirname(fileURLToPath(import.meta.url));
8-
dotenv.config({ path: path.resolve(__dirname, '../.env') });
98

10-
// Load secrets from files (Docker Swarm / Kubernetes support)
9+
dotenv.config({ path: path.resolve(__dirname, '../.env') });
1110
loadSecrets();
1211

13-
// Run pre-flight checks for essential environment variables
1412
try {
1513
runPreflightChecks();
1614
} catch (error) {
17-
process.exitCode = 1;
18-
throw error;
15+
console.error(
16+
'PreflightChecks failed due to missing environment variables.',
17+
error
18+
);
19+
// eslint-disable-next-line n/no-process-exit
20+
process.exit(1);
21+
}
22+
23+
console.log('Starting server...');
24+
try {
25+
await import('./SparkyFitnessServer.js');
26+
} catch (error) {
27+
console.error('Failed to start the server module:', error);
28+
// eslint-disable-next-line n/no-process-exit
29+
process.exit(1);
1930
}

SparkyFitnessServer/nodemon.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
"coverage"
1919
],
2020
"ext": "js,ts,json",
21-
"exec": "tsx SparkyFitnessServer.ts"
21+
"exec": "tsx index.ts"
2222
}

0 commit comments

Comments
 (0)