feat(app): revert port & network changes

This commit is contained in:
ItzCrazyKns 2024-05-13 19:58:17 +05:30
parent 100872f2d9
commit 0993c5a760
No known key found for this signature in database
GPG Key ID: 8162927C7CCE3065
6 changed files with 12 additions and 21 deletions

View File

@ -2,11 +2,8 @@ FROM node:alpine
ARG NEXT_PUBLIC_WS_URL
ARG NEXT_PUBLIC_API_URL
ARG PORT
ENV NEXT_PUBLIC_WS_URL=${NEXT_PUBLIC_WS_URL}
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
ENV PORT=${PORT}
WORKDIR /home/perplexica

View File

@ -4,7 +4,7 @@ services:
volumes:
- ./searxng:/etc/searxng:rw
ports:
- 31336:8080
- 4000:8080
networks:
- perplexica-network
@ -17,7 +17,7 @@ services:
depends_on:
- searxng
ports:
- 31338:31338
- 3001:3001
networks:
- perplexica-network
@ -26,13 +26,12 @@ services:
context: .
dockerfile: app.dockerfile
args:
- NEXT_PUBLIC_API_URL=http://127.0.0.1:31338/api
- NEXT_PUBLIC_WS_URL=ws://127.0.0.1:31338
- PORT=31337
- NEXT_PUBLIC_API_URL=http://127.0.0.1:3001/api
- NEXT_PUBLIC_WS_URL=ws://127.0.0.1:3001
depends_on:
- perplexica-backend
ports:
- 31337:31337
- 3000:3000
networks:
- perplexica-network

View File

@ -1,6 +1,5 @@
[GENERAL]
PORT = 31338 # Port to run the server on
BIND_ADDRESS = "0.0.0.0"
PORT = 3001 # Port to run the server on
SIMILARITY_MEASURE = "cosine" # "cosine" or "dot"
[API_KEYS]

View File

@ -3,11 +3,10 @@ import express from 'express';
import cors from 'cors';
import http from 'http';
import routes from './routes';
import { getBindAddress, getPort } from './config';
import { getPort } from './config';
import logger from './utils/logger';
const port = getPort();
const bindAddress = getBindAddress();
const app = express();
const server = http.createServer(app);
@ -24,7 +23,7 @@ app.get('/api', (_, res) => {
res.status(200).json({ status: 'ok' });
});
server.listen(port, bindAddress, () => {
server.listen(port, () => {
logger.info(`Server is running on port ${port}`);
});

View File

@ -7,7 +7,6 @@ const configFileName = 'config.toml';
interface Config {
GENERAL: {
PORT: number;
BIND_ADDRESS: string;
SIMILARITY_MEASURE: string;
};
API_KEYS: {
@ -31,8 +30,6 @@ const loadConfig = () =>
export const getPort = () => loadConfig().GENERAL.PORT;
export const getBindAddress = () => loadConfig().GENERAL.BIND_ADDRESS;
export const getSimilarityMeasure = () =>
loadConfig().GENERAL.SIMILARITY_MEASURE;

View File

@ -1,2 +1,2 @@
NEXT_PUBLIC_WS_URL=ws://localhost:31338
NEXT_PUBLIC_API_URL=http://localhost:31338/api
NEXT_PUBLIC_WS_URL=ws://localhost:3001
NEXT_PUBLIC_API_URL=http://localhost:3001/api