serverpreconfigured 2.2.17 → 2.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/modules/sessions.js
CHANGED
package/dist/settings/env.js
CHANGED
|
@@ -6,15 +6,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const fs_1 = __importDefault(require("fs"));
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const custom_env_path = path_1.default.join(process.cwd(), "spc_envfile.json");
|
|
9
|
+
const custom_env_path_prod = path_1.default.join(process.cwd(), "spc_envfile_prod.json");
|
|
9
10
|
var custom_env = {};
|
|
10
11
|
try {
|
|
11
|
-
|
|
12
|
+
if (process.env.DEV_ENVIRONMENT) {
|
|
13
|
+
custom_env = JSON.parse(fs_1.default.readFileSync(custom_env_path).toString());
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
custom_env = JSON.parse(fs_1.default.readFileSync(custom_env_path_prod).toString());
|
|
17
|
+
}
|
|
12
18
|
}
|
|
13
19
|
catch (e) {
|
|
14
20
|
custom_env = {};
|
|
15
21
|
}
|
|
16
22
|
const ENV = {
|
|
17
|
-
NODE_ENV: process.env.
|
|
23
|
+
NODE_ENV: process.env.DEV_ENVIRONMENT ? 'development' : 'production',
|
|
18
24
|
ALLOW_CORS: process.env.ALLOW_CORS == 'ALLOW' ? true : false,
|
|
19
25
|
PORT: process.env.SERVER_PORT ? parseInt(process.env.SERVER_PORT) : 3000,
|
|
20
26
|
DATABASE: {
|
|
@@ -23,7 +29,7 @@ const ENV = {
|
|
|
23
29
|
host: (custom_env.DATABASE && custom_env.DATABASE.HOST) || (process.env.DATABASE_HOST ? process.env.DATABASE_HOST : 'localhost'),
|
|
24
30
|
database: (custom_env.DATABASE && custom_env.DATABASE.DATABASE) || (process.env.DATABASE_DATABASE || 'postgres'),
|
|
25
31
|
username: (custom_env.DATABASE && custom_env.DATABASE.USERNAME) || (process.env.DATABASE_USERNAME ? process.env.DATABASE_USERNAME : 'postgres'),
|
|
26
|
-
password: (custom_env.DATABASE && custom_env.DATABASE.
|
|
32
|
+
password: (custom_env.DATABASE && custom_env.DATABASE.PASSWORD) || process.env.DATABASE_PASSWORD ? process.env.DATABASE_PASSWORD : '',
|
|
27
33
|
},
|
|
28
34
|
SESSION_SECRET: process.env.SESSION_SECRET ? process.env.SESSION_SECRET : "secret key session",
|
|
29
35
|
};
|
package/package.json
CHANGED
package/src/modules/sessions.ts
CHANGED
package/src/settings/env.ts
CHANGED
|
@@ -23,7 +23,7 @@ const ENV={
|
|
|
23
23
|
host:(custom_env.DATABASE&&custom_env.DATABASE.HOST)||(process.env.DATABASE_HOST?process.env.DATABASE_HOST:'localhost'),
|
|
24
24
|
database:(custom_env.DATABASE&&custom_env.DATABASE.DATABASE)||(process.env.DATABASE_DATABASE||'postgres'),
|
|
25
25
|
username:(custom_env.DATABASE&&custom_env.DATABASE.USERNAME)||(process.env.DATABASE_USERNAME?process.env.DATABASE_USERNAME:'postgres'),
|
|
26
|
-
password:(custom_env.DATABASE&&custom_env.DATABASE.
|
|
26
|
+
password:(custom_env.DATABASE&&custom_env.DATABASE.PASSWORD)||process.env.DATABASE_PASSWORD?process.env.DATABASE_PASSWORD:'',
|
|
27
27
|
},
|
|
28
28
|
SESSION_SECRET:process.env.SESSION_SECRET?process.env.SESSION_SECRET:"secret key session",
|
|
29
29
|
};
|