From 251ea2f77cc6a2111b75a7b39bcd34bd616c1f09 Mon Sep 17 00:00:00 2001 From: GreenAsJade Date: Tue, 12 Sep 2023 21:56:29 +0930 Subject: [PATCH] Decide on ai_host for non-anoek developers based on OGS_BACKEND --- src/lib/sockets.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/sockets.ts b/src/lib/sockets.ts index b6e5b740d3..17a4527c82 100644 --- a/src/lib/sockets.ts +++ b/src/lib/sockets.ts @@ -30,12 +30,13 @@ if ( // if we're developing locally but connecting to the production system, use our local system for estimation ai_host = `http://localhost:13284`; console.log("AI Host set to: ", ai_host); -} else if (window.location.hostname === "localhost") { +} else if (process.env.OGS_BACKEND === "LOCAL") { // if we're a developer using a local server, then use it for ai ai_host = "http://localhost:13284"; } else if ( // The CI doesn't work with beta. Note that jest in the CI has NODE_ENV==="test". // the .org exception is for anoek's development environment + // This logic causes web developers who are _not_ using a local server to use Beta for AI. (process.env.NODE_ENV === "development" && window.location.hostname.indexOf(".org") < 0) || window.location.hostname.indexOf("beta") >= 0 || window.location.hostname.indexOf("dev") >= 0