]> Untitled Git - lemmy-ui.git/blobdiff - src/shared/env.ts
Documenting and changing a few env vars. Fixes #661 (#739)
[lemmy-ui.git] / src / shared / env.ts
index 43b9ce0da50b9e2f61f1963275e75c7980bfde2e..12260e151106b9c20cc64088612a3c19f5fc9999 100644 (file)
@@ -1,9 +1,9 @@
 import { isBrowser } from "./utils";
 
-const testHost = "localhost:8536";
+const testHost = "0.0.0.0:8536";
 
 let internalHost =
-  (!isBrowser() && process.env.LEMMY_INTERNAL_HOST) || testHost; // used for local dev
+  (!isBrowser() && process.env.LEMMY_UI_LEMMY_INTERNAL_HOST) || testHost; // used for local dev
 export let externalHost: string;
 let host: string;
 let wsHost: string;
@@ -27,15 +27,16 @@ if (isBrowser()) {
   secure = window.location.protocol == "https:" ? "s" : "";
 } else {
   // server-side
-  externalHost = process.env.LEMMY_EXTERNAL_HOST || testHost;
+  externalHost = process.env.LEMMY_UI_LEMMY_EXTERNAL_HOST || testHost;
   host = internalHost;
-  wsHost = process.env.LEMMY_WS_HOST || host;
-  secure = process.env.LEMMY_HTTPS == "true" ? "s" : "";
+  wsHost = process.env.LEMMY_UI_LEMMY_WS_HOST || externalHost;
+  secure = process.env.LEMMY_UI_HTTPS == "true" ? "s" : "";
 }
 
 export const httpBaseInternal = `http://${host}`; // Don't use secure here
 export const httpBase = `http${secure}://${host}`;
-export const wsUri = `ws${secure}://${wsHost}/api/v3/ws`;
+export const wsUriBase = `ws${secure}://${wsHost}`;
+export const wsUri = `${wsUriBase}/api/v3/ws`;
 export const pictrsUri = `${httpBase}/pictrs/image`;
 export const isHttps = secure.endsWith("s");