From 6c45b72512afa8ae3dba990ebb6538025a3d2921 Mon Sep 17 00:00:00 2001 From: Luna Date: Sat, 19 Nov 2022 15:41:05 +0000 Subject: [PATCH] Add support for changing the port --- .env.example | 5 +++++ src/index.ts | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..5827129 --- /dev/null +++ b/.env.example @@ -0,0 +1,5 @@ +POSTGRES_URL=postgresql://user:password@your-host:5432/database +ALLNET_PORT=20080 +MUCHA_PORT=10082 +SERVICE_PORT=9002 +API_PORT=9003 \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 9eae0ca..09e7c19 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,10 +27,12 @@ export const prisma = new PrismaClient(); const appRouter = Router(); -const PORT_ALLNET = 80; -const PORT_MUCHA = 10082; -const PORT_BNGI = 9002; -const PORT_API = 9003; +console.log(process.env); + +const PORT_ALLNET = process.env.ALLNET_PORT !== undefined ? parseInt(process.env.ALLNET_PORT) : 80; +const PORT_MUCHA = process.env.MUCHA_PORT !== undefined ? parseInt(process.env.MUCHA_PORT) : 10082; +const PORT_BNGI = process.env.SERVICE_PORT !== undefined ? parseInt(process.env.SERVICE_PORT) : 9002; +const PORT_API = process.env.API_PORT !== undefined ? parseInt(process.env.API_PORT) : 9003; const app = express(); const muchaApp = express();