forked from hashgraph/guardian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecosystem.config.js
105 lines (96 loc) · 2.43 KB
/
ecosystem.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import fs from 'fs';
import path from 'path';
function readEnvFile(filePath) {
const envFile = path.resolve(__dirname, filePath);
return fs
.readFileSync(envFile, { encoding: 'utf8' })
.split('\n')
.reduce((acc, line) => {
if (!line) return acc;
const parts = line.split('#');
const [keyValue] = parts;
if (!keyValue) return acc;
const [key, value] = keyValue.split('=');
return { ...acc, [key]: value.trim().replace(/^("|')|("|')$/g, '') };
}, {});
}
console.log(readEnvFile('./worker-service/.env'));
const appEnv = readEnvFile('.env');
const apps = [{
name: 'logger',
script: 'npm run start',
cwd: './logger-service/dist',
env: {
...readEnvFile('./logger-service/.env'),
},
},
{
name: 'gateway',
script: 'npm run start',
cwd: './api-gateway/dist',
env: {
...readEnvFile('./api-gateway/.env'),
},
},
{
name: 'auth',
script: 'npm run start',
cwd: './auth-service/dist',
env: {
SECRET_MANAGER: appEnv.SECRET_MANAGER,
...readEnvFile('./auth-service/.env'),
},
},
{
name: 'guardian',
script: 'npm run start',
cwd: './guardian-service/dist',
env: {
SECRET_MANAGER: appEnv.SECRET_MANAGER,
...readEnvFile('./guardian-service/.env'),
},
},
{
name: 'policy',
script: 'npm run start',
cwd: './policy-service/dist',
env: {
SECRET_MANAGER: appEnv.SECRET_MANAGER,
...readEnvFile('./policy-service/.env'),
},
},
{
name: 'worker',
script: 'npm run start',
cwd: './worker-service/dist',
env: {
SECRET_MANAGER: appEnv.SECRET_MANAGER,
...readEnvFile('./worker-service/.env'),
},
},
{
name: 'topic',
script: 'npm run start',
cwd: './topic-viewer/dist',
},
{
name: 'mrv',
script: 'npm run start',
cwd: './mrv-sender/dist',
},
{
name: 'frontend',
script: 'npm run start',
cwd: './frontend/dist',
},
{
name: 'analytics',
script: 'npm run start',
cwd: './analytics-service/dist',
env: {
...readEnvFile('./analytics-service/.env'),
},
}];
export {
apps,
};