Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documenting and changing a few env vars. Fixes #661 #739

Merged
merged 1 commit into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<head>`.
2 changes: 1 addition & 1 deletion src/server/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(`
<!DOCTYPE html>
Expand Down
8 changes: 4 additions & 4 deletions src/shared/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down