feat(server): add bind address
This commit is contained in:
parent
828eeb0c77
commit
9816eb1d36
|
@ -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
|
||||
|
|
|
@ -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}`);
|
||||
});
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue