feature/IO-2742-redis - Normalize Network
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
27
server.js
27
server.js
@@ -44,9 +44,7 @@ const SOCKETIO_CORS_ORIGIN = [
|
||||
"https://www.test.promanager.web-est.com",
|
||||
"https://test.promanager.web-est.com",
|
||||
"https://www.promanager.web-est.com",
|
||||
"https://www.promanager.web-est.com",
|
||||
"http://localhost:3000",
|
||||
"https://localhost:3000"
|
||||
"https://www.promanager.web-est.com"
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -107,24 +105,9 @@ const main = async () => {
|
||||
|
||||
let server;
|
||||
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
console.log("Setting up HTTPS for Development");
|
||||
// In development, run HTTPS server
|
||||
const sslKeyPath = path.resolve(__dirname, "./certs/key.pem");
|
||||
const sslCertPath = path.resolve(__dirname, "./certs/cert.pem");
|
||||
|
||||
const httpsOptions = {
|
||||
key: fs.readFileSync(sslKeyPath),
|
||||
cert: fs.readFileSync(sslCertPath)
|
||||
};
|
||||
|
||||
server = https.createServer(httpsOptions, app);
|
||||
logger.log(`[${process.env.NODE_ENV}] HTTPS Server will run on port ${port}`, "INFO", "api");
|
||||
} else {
|
||||
// In production or default, use HTTP
|
||||
server = http.createServer(app);
|
||||
logger.log(`[${process.env.NODE_ENV}] HTTP Server will run on port ${port}`, "INFO", "api");
|
||||
}
|
||||
// In production or default, use HTTP
|
||||
server = http.createServer(app);
|
||||
logger.log(`[${process.env.NODE_ENV}] Attempting to start process on port ${port}`, "INFO", "api");
|
||||
|
||||
// Redis client setup for Pub/Sub and Key-Value Store
|
||||
const pubClient = createClient({ url: process.env.REDIS_URL || "redis://localhost:6379" });
|
||||
@@ -135,7 +118,7 @@ const main = async () => {
|
||||
|
||||
try {
|
||||
await Promise.all([pubClient.connect(), subClient.connect()]);
|
||||
logger.log("Connected to Redis", "INFO", "redis");
|
||||
logger.log(`[${process.env.NODE_ENV}] Connected to Redis`, "INFO", "redis", "api");
|
||||
} catch (redisError) {
|
||||
logger.log("Failed to connect to Redis", "ERROR", "redis", redisError);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user