feat(server): add bind address
This commit is contained in:
parent
828eeb0c77
commit
9816eb1d36
|
@ -1,5 +1,6 @@
|
||||||
[GENERAL]
|
[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"
|
SIMILARITY_MEASURE = "cosine" # "cosine" or "dot"
|
||||||
|
|
||||||
[API_KEYS]
|
[API_KEYS]
|
||||||
|
@ -8,4 +9,4 @@ GROQ = "" # Groq API key - gsk_1234567890abcdef1234567890abcdef
|
||||||
|
|
||||||
[API_ENDPOINTS]
|
[API_ENDPOINTS]
|
||||||
SEARXNG = "http://localhost:32768" # SearxNG API URL
|
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 cors from 'cors';
|
||||||
import http from 'http';
|
import http from 'http';
|
||||||
import routes from './routes';
|
import routes from './routes';
|
||||||
import { getPort } from './config';
|
import { getBindAddress, getPort } from './config';
|
||||||
import logger from './utils/logger';
|
import logger from './utils/logger';
|
||||||
|
|
||||||
const port = getPort();
|
const port = getPort();
|
||||||
|
const bindAddress = getBindAddress();
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const server = http.createServer(app);
|
const server = http.createServer(app);
|
||||||
|
@ -23,7 +24,7 @@ app.get('/api', (_, res) => {
|
||||||
res.status(200).json({ status: 'ok' });
|
res.status(200).json({ status: 'ok' });
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen(port, () => {
|
server.listen(port, bindAddress, () => {
|
||||||
logger.info(`Server is running on port ${port}`);
|
logger.info(`Server is running on port ${port}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ const configFileName = 'config.toml';
|
||||||
interface Config {
|
interface Config {
|
||||||
GENERAL: {
|
GENERAL: {
|
||||||
PORT: number;
|
PORT: number;
|
||||||
|
BIND_ADDRESS: string;
|
||||||
SIMILARITY_MEASURE: string;
|
SIMILARITY_MEASURE: string;
|
||||||
};
|
};
|
||||||
API_KEYS: {
|
API_KEYS: {
|
||||||
|
@ -30,6 +31,8 @@ const loadConfig = () =>
|
||||||
|
|
||||||
export const getPort = () => loadConfig().GENERAL.PORT;
|
export const getPort = () => loadConfig().GENERAL.PORT;
|
||||||
|
|
||||||
|
export const getBindAddress = () => loadConfig().GENERAL.BIND_ADDRESS;
|
||||||
|
|
||||||
export const getSimilarityMeasure = () =>
|
export const getSimilarityMeasure = () =>
|
||||||
loadConfig().GENERAL.SIMILARITY_MEASURE;
|
loadConfig().GENERAL.SIMILARITY_MEASURE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue