refactoring and clean up
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
require ('dotenv').config();
|
||||
const express = require('express');
|
||||
const {getEnv} = require('@nexusai/shared');
|
||||
const {getEnv, PORTS, SERVICES, ORCHESTRATION} = require('@nexusai/shared');
|
||||
const chatRouter = require('./routes/chat');
|
||||
const sessionsRouter = require('./routes/sessions');
|
||||
const cors = require('cors');
|
||||
@@ -8,25 +8,28 @@ const cors = require('cors');
|
||||
const app = express();
|
||||
app.use(express.json());
|
||||
|
||||
const PORT = getEnv('PORT', '4000'); // Default to 4000 if PORT is not set
|
||||
|
||||
app.use(cors({
|
||||
origin: [
|
||||
getEnv('CORS_ORIGIN', 'http://localhost:5173'),
|
||||
'http://localhost:5173',
|
||||
getEnv('CORS_ORIGIN', ORCHESTRATION.CORS_ORIGIN),
|
||||
ORCHESTRATION.CORS_ORIGIN,
|
||||
],
|
||||
methods: ['GET', 'POST', 'DELETE'],
|
||||
allowedHeaders: ['Content-Type'],
|
||||
}))
|
||||
|
||||
const PORT = getEnv('PORT', PORTS.ORCHESTRATION);
|
||||
const MEMORY_URL = getEnv('MEMORY_SERVICE_URL', SERVICES.MEMORY_URL);
|
||||
const EMBEDDING_URL = getEnv('EMBEDDING_SERVICE_URL', SERVICES.EMBEDDING_URL);
|
||||
const INFERENCE_URL = getEnv('INFERENCE_SERVICE_URL', SERVICES.INFERENCE_URL);
|
||||
|
||||
// Health check endpoint
|
||||
app.get('/health', (req, res) => {
|
||||
res.json({
|
||||
service: 'Orchestration Service',
|
||||
status: 'healthy',
|
||||
memoryService: getEnv('MEMORY_SERVICE_URL', 'http://localhost:3002'),
|
||||
embeddingService: getEnv('EMBEDDING_SERVICE_URL', 'http://localhost:3003'),
|
||||
inferenceService: getEnv('INFERENCE_SERVICE_URL', 'http://localhost:3001'),
|
||||
service: 'Orchestration Service',
|
||||
status: 'healthy',
|
||||
memoryService: MEMORY_URL,
|
||||
embeddingService: EMBEDDING_URL,
|
||||
inferenceService: INFERENCE_URL,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user