-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathecosystem.config.ts
55 lines (48 loc) · 1.62 KB
/
ecosystem.config.ts
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
import { Environments } from "./models/environments";
// Container for all environments
const environments = new Environments;
// Development Environment
environments.development = {
port: 3000,
envName: 'development',
hashingSecret: 'developmentSecret',
client_base_url: 'http://localhost:4200'
};
// Staging environment (default)
environments.staging = {
port: 4000,
envName: 'staging',
hashingSecret: 'stagingSecret',
client_base_url: 'https://staging.example.com'
};
// Production environment
environments.production = {
port: 5000,
envName: 'production',
hashingSecret: 'productionSecret',
client_base_url: 'https://www.example.com'
};
// Determine which environment was requested from the command line
const currentEnvironment = typeof (process.env.NODE_ENV) === 'string' ? process.env.NODE_ENV.toLowerCase() : '';
// Check if the requested environment exists, if not, default to the Staging Environment
export const env = environments[currentEnvironment] ? environments[currentEnvironment] : environments.staging;
// Envitonment Variables for Process Manager (PM2)
export const apps = [
{
name: 'BINANCE_TRADER_BOT',
script: './index.js',
watch: false,
env_development: {
PORT: environments.development.port,
NODE_ENV: environments.development.envName
},
env_staging: {
PORT: environments.staging.port,
NODE_ENV: environments.staging.envName
},
env_production: {
PORT: environments.production.port,
NODE_ENV: environments.production.envName
}
}
];