From: Dessalines Date: Thu, 4 Aug 2022 18:21:20 +0000 (-0400) Subject: Documenting and changing a few env vars. Fixes #661 (#739) X-Git-Url: http://these/git/%22https:/image.com/%22?a=commitdiff_plain;h=df31cb53cb038b28f2c10a129b6d85d9223cf804;p=lemmy-ui.git Documenting and changing a few env vars. Fixes #661 (#739) --- diff --git a/README.md b/README.md index a6969d0..e1e6e1f 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,19 @@ The official web app for [Lemmy](https://github.com/LemmyNet/lemmy), written in inferno. Based off of MrFoxPro's [inferno-isomorphic-template](https://github.com/MrFoxPro/inferno-isomorphic-template). + +## Configuration + +The following environment variables can be used to configure lemmy-ui: + +`ENV_VAR` | type | default | description +--- | --- | --- | --- +`LEMMY_UI_HOST` | `string` | `0.0.0.0:1234` | The IP / port that the lemmy-ui isomorphic node server is hosted at. +`LEMMY_UI_LEMMY_INTERNAL_HOST` | `string` | `0.0.0.0:8536` | The internal IP / port that lemmy is hosted at. Often `lemmy:8536` if using docker. +`LEMMY_UI_LEMMY_EXTERNAL_HOST` | `string` | `0.0.0.0:8536` | The external IP / port that lemmy is hosted at. Often `DOMAIN.TLD`. +`LEMMY_UI_LEMMY_WS_HOST` | `string` | `0.0.0.0:8536` | An alternate location for lemmy's websocket address. Not usually necessary. +`LEMMY_UI_HTTPS` | `bool` | `false` | Whether to use https. +`LEMMY_UI_EXTRA_THEMES_FOLDER` | `string` | `./extra_themes` | A location for additional lemmy css themes. +`LEMMY_UI_DEBUG` | `bool` | `false` | Loads the [Eruda](https://github.com/liriliri/eruda) debugging utility. +`LEMMY_UI_DISABLE_CSP` | `bool` | `false` | Disables CSP security headers +`LEMMY_UI_CUSTOM_HTML_HEADER` | `string` | | Injects a custom script into ``. diff --git a/src/server/index.tsx b/src/server/index.tsx index d508dab..ebaa947 100644 --- a/src/server/index.tsx +++ b/src/server/index.tsx @@ -189,7 +189,7 @@ server.get("/*", async (req, res) => { const symbols = renderToString(SYMBOLS); const helmet = Helmet.renderStatic(); - const config: ILemmyConfig = { wsHost: process.env.LEMMY_WS_HOST }; + const config: ILemmyConfig = { wsHost: process.env.LEMMY_UI_LEMMY_WS_HOST }; res.send(` diff --git a/src/shared/env.ts b/src/shared/env.ts index 2088bd6..12260e1 100644 --- a/src/shared/env.ts +++ b/src/shared/env.ts @@ -3,7 +3,7 @@ import { isBrowser } from "./utils"; 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,10 +27,10 @@ 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 || externalHost; - 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