-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
32 lines (30 loc) · 931 Bytes
/
server.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
const {handleServerStart, handleSecureServerStart} = require("lib")
const app = require("./gateway.js")
module.exports = {
start: () => {
const successCallback = () => {
console.log(`🗺️ Gateway On ▶ PORT ${process.env.gateway_PORT}`)
}
const failureCallback = (err) => {
if(err != undefined){
console.log(err)
}
console.log("🗺️ Gateway Off ❌")
}
const successCallbackSecure = () => {
console.log(`🗺️🔒 Secure Gateway On ▶ PORT ${process.env.gateway_PORT_SECURE}`)
}
const failureCallbackSecure = () => {
console.log("🗺️🔒 Secure Gateway Off ❌")
}
if(process.env.gateway_ON == "true"){
handleServerStart(app, process.env.gateway_PORT, successCallback, failureCallback)
handleSecureServerStart(app, process.env.gateway_PORT_SECURE, successCallbackSecure, failureCallbackSecure)
}
else{
failureCallback()
failureCallbackSecure()
}
},
app
}