From 22ab2d581a1c5283d0a0f0c3aca0b400f1391842 Mon Sep 17 00:00:00 2001 From: Voktor Stolenets Date: Tue, 24 Dec 2024 17:36:38 +0200 Subject: [PATCH] Change: fix env --- src/env.ts | 1 + src/server.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/env.ts b/src/env.ts index 8c87b29..9f134b9 100644 --- a/src/env.ts +++ b/src/env.ts @@ -1,6 +1,7 @@ import * as dotenv from "dotenv"; dotenv.config(); +export const HOST = process.env.HOST || "localhost"; export const PORT = Number(process.env.PORT || 3000); export const DATABASE_URL = process.env.DATABASE_URL || "mongodb://localhost:27017"; diff --git a/src/server.ts b/src/server.ts index 7ce6207..726856e 100644 --- a/src/server.ts +++ b/src/server.ts @@ -43,8 +43,8 @@ const startServer = async () => { fastify.post("/images", uploadHandler); - await fastify.listen({host: "0.0.0.0", port: PORT }); - console.log(`Server running on http://${host}:${PORT}`); + await fastify.listen({ host: "0.0.0.0", port: PORT }); + console.log(`Server running on http://${HOST}:${PORT}`); } catch (error) { fastify.log.error(error); process.exit(1);