Make PUBLIC_GROUP_ID optional for full mode
This commit is contained in:
parent
ed1775aeb5
commit
e958877600
1 changed files with 11 additions and 4 deletions
|
|
@ -1,16 +1,23 @@
|
|||
import { PUBLIC_RELAY_URL, PUBLIC_GROUP_ID } from "$env/static/public";
|
||||
import { PUBLIC_RELAY_URL } from "$env/static/public";
|
||||
import { env } from "$env/dynamic/public";
|
||||
|
||||
// Required: a missing relay or group id is a misconfiguration, so let the
|
||||
// static import fail loudly (and keep them typed as string).
|
||||
// Required: a missing relay is always a misconfiguration, so let the static
|
||||
// import fail loudly (and keep it typed as string).
|
||||
export const RELAY_URL = PUBLIC_RELAY_URL;
|
||||
export const GROUP_ID = PUBLIC_GROUP_ID;
|
||||
|
||||
// Optional: read dynamically so an unset var is undefined and falls back to its
|
||||
// default, instead of breaking the static-import contract at load time.
|
||||
export const TITLE = env.PUBLIC_TITLE ?? "";
|
||||
export const MODE: "simple" | "full" =
|
||||
env.PUBLIC_MODE === "full" ? "full" : "simple";
|
||||
|
||||
// Required in simple mode (the single forum's group), optional in full mode
|
||||
// where rooms are selected at runtime. Read dynamically so full mode can omit
|
||||
// it without breaking the static-import contract.
|
||||
export const GROUP_ID = env.PUBLIC_GROUP_ID ?? "";
|
||||
if (MODE === "simple" && !GROUP_ID) {
|
||||
throw new Error("PUBLIC_GROUP_ID is required in simple mode");
|
||||
}
|
||||
export const JOINCODE_REQUIRED = env.PUBLIC_JOINCODE === "yes";
|
||||
export const LABELS = (env.PUBLIC_LABELS ?? "")
|
||||
.split(",")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue