From 67d85a9fc5993461afd741b361d9e820a6f0e735 Mon Sep 17 00:00:00 2001 From: Diego Magdaleno Date: Sat, 15 May 2021 16:15:52 -0500 Subject: Config: Be able to configure the target_url --- src/routes/gateway.ts | 5 ++++- src/util/Config.ts | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/routes/gateway.ts b/src/routes/gateway.ts index cab685e2..9d34c999 100644 --- a/src/routes/gateway.ts +++ b/src/routes/gateway.ts @@ -1,9 +1,12 @@ import { Router } from "express"; +import Config from "../util/Config" const router = Router(); +const url = Config.get().server.root_url; + router.get("/", (req, res) => { - res.send({ url: "ws://localhost:3002" }); + res.send({ url: `ws://${url}:3002` }); }); export default router; diff --git a/src/util/Config.ts b/src/util/Config.ts index f1f0f458..e52cd2f7 100644 --- a/src/util/Config.ts +++ b/src/util/Config.ts @@ -21,6 +21,9 @@ export interface RateLimitOptions { } export interface DefaultOptions { + server: { + root_url: string; + }; general: { instance_id: string; }; @@ -108,6 +111,9 @@ export interface DefaultOptions { } export const DefaultOptions: DefaultOptions = { + server: { + root_url: "localhost" // we are localhost unless the oposite is specified + }, general: { instance_id: Snowflake.generate(), }, -- cgit 1.5.1