-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
42 lines (37 loc) · 1.27 KB
/
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
/*****************************************************************************
*
* This file is copyright (c) PTC, Inc.
* All rights reserved.
*
* Name: config.js
* Description: This file contains configuration settings for the application. It utilizes the
* 'dotenv' module to load environment variables from a '.env' file and 'assert' module for
* ensuring that required environment variables are defined.
*
* Update History:
* 0.0.1: Initial Release
*
* Version: 0.0.1
******************************************************************************/
const dotenv = require('dotenv');
const assert = require('assert');
// Load environment variables from the '.env' file
dotenv.config();
// Destructure required environment variables
const {PORT, HOST, HOST_URL, USER, PASSWORD, DATABASE, SERVER, DBPORT} = process.env;
assert(PORT, 'PORT is required');
assert(HOST, "HOST is required");
// Export configuration settings of express server and PostgreSQL database
module.exports = {
port: PORT,
host: HOST,
url: HOST_URL,
// PostgreSQL database connection parameters
postgreSql:{
user: USER,
password: PASSWORD,
host: SERVER,
port: DBPORT,
database: DATABASE
}
}