From 0f965bbb508658767485db402ad52f018b78cef8 Mon Sep 17 00:00:00 2001 From: Brandon Sanderson Date: Fri, 1 Jan 2021 11:51:26 -0800 Subject: [PATCH 1/2] Add `--listenOn` to CLI options. This allows setting the listen IP to something other than `localhost`. `localhost` is a good default, but isn't suitable for certain setups, including setups where `majestic` is run inside a container. --- server/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/index.ts b/server/index.ts index c23ea5b..f74aa0f 100644 --- a/server/index.ts +++ b/server/index.ts @@ -46,7 +46,8 @@ async function main() { playground: "/debug" }, async () => { - const url = `http://localhost:${port}`; + const listenOn = args.listenOn || "localhost"; + const url = `http://${listenOn}:${port}`; console.log(`⚡ Majestic v${pkg.version} is running at ${url} `); if (args.app) { From 4cfc153f68d49d4f70b11d1593264818f75371c0 Mon Sep 17 00:00:00 2001 From: Brandon Sanderson Date: Fri, 1 Jan 2021 13:30:33 -0800 Subject: [PATCH 2/2] Document new option. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 12dd8e0..3a40d38 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,8 @@ You can configure Majestic by adding `majestic` key to `package.json`. `--version` - Will print the version of Majestic and will exit. +`--listenOn` - Will listen on this IP/host instead of localhost. + ### Shortcut keys `alt+t` - run all tests