From 9d848bf3a9a6a07802d17e4b225b0b42a40d42cd Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Fri, 16 Apr 2021 17:44:43 +0200 Subject: :bug: fix port not picking up env file --- src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/index.ts b/src/index.ts index 85859319..3a05cdfa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,10 @@ import { config } from "dotenv"; config(); import { DiscordServer } from "./Server"; -const server = new DiscordServer({ port: 3000 || process.env.PORT }); +var port = Number(process.env.PORT); +if (isNaN(port)) port = 3000; + +const server = new DiscordServer({ port }); server.start().catch(console.error); // @ts-ignore -- cgit 1.5.1