diff --git a/sample.config.toml b/sample.config.toml index 7bc8880..5342fe4 100644 --- a/sample.config.toml +++ b/sample.config.toml @@ -1,5 +1,6 @@ [GENERAL] -PORT = 3001 # Port to run the server on +PORT = 31338 # Port to run the server on +BIND_ADDRESS = "0.0.0.0" SIMILARITY_MEASURE = "cosine" # "cosine" or "dot" [API_KEYS] @@ -8,4 +9,4 @@ GROQ = "" # Groq API key - gsk_1234567890abcdef1234567890abcdef [API_ENDPOINTS] SEARXNG = "http://localhost:32768" # SearxNG API URL -OLLAMA = "" # Ollama API URL - http://host.docker.internal:11434 +OLLAMA = "" # Ollama API URL - http://127.0.0.1:11434 diff --git a/src/app.ts b/src/app.ts index b8c2371..33184bf 100644 --- a/src/app.ts +++ b/src/app.ts @@ -3,10 +3,11 @@ import express from 'express'; import cors from 'cors'; import http from 'http'; import routes from './routes'; -import { getPort } from './config'; +import { getBindAddress, getPort } from './config'; import logger from './utils/logger'; const port = getPort(); +const bindAddress = getBindAddress(); const app = express(); const server = http.createServer(app); @@ -23,7 +24,7 @@ app.get('/api', (_, res) => { res.status(200).json({ status: 'ok' }); }); -server.listen(port, () => { +server.listen(port, bindAddress, () => { logger.info(`Server is running on port ${port}`); }); diff --git a/src/config.ts b/src/config.ts index 7c0c7f1..f600f58 100644 --- a/src/config.ts +++ b/src/config.ts @@ -7,6 +7,7 @@ const configFileName = 'config.toml'; interface Config { GENERAL: { PORT: number; + BIND_ADDRESS: string; SIMILARITY_MEASURE: string; }; API_KEYS: { @@ -30,6 +31,8 @@ const loadConfig = () => export const getPort = () => loadConfig().GENERAL.PORT; +export const getBindAddress = () => loadConfig().GENERAL.BIND_ADDRESS; + export const getSimilarityMeasure = () => loadConfig().GENERAL.SIMILARITY_MEASURE;