Skip to content

Commit

Permalink
Add GRIST_HELP_CENTER environment variable (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisDelbosc authored Nov 28, 2022
1 parent d47cac3 commit a4b1145
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ GRIST_SESSION_DOMAIN | if set, associates the cookie with the given domain - oth
GRIST_SESSION_SECRET | a key used to encode sessions
GRIST_FORCE_LOGIN | when set to 'true' disables anonymous access
GRIST_SINGLE_ORG | set to an org "domain" to pin client to that org
GRIST_HELP_CENTER | set the help center link ref
GRIST_SUPPORT_ANON | if set to 'true', show UI for anonymous access (not shown by default)
GRIST_SUPPORT_EMAIL | if set, give a user with the specified email support powers. The main extra power is the ability to share sites, workspaces, and docs with all users in a listed way.
GRIST_THROTTLE_CPU | if set, CPU throttling is enabled
Expand Down
14 changes: 13 additions & 1 deletion app/common/gristUrls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const MIN_URLID_PREFIX_LENGTH = 12;
*/

export const commonUrls = {
help: "https://support.getgrist.com",
help: getHelpCenterUrl(),
helpAccessRules: "https://support.getgrist.com/access-rules",
helpConditionalFormatting: "https://support.getgrist.com/conditional-formatting",
helpLinkingWidgets: "https://support.getgrist.com/linking-widgets",
Expand Down Expand Up @@ -493,6 +493,9 @@ export interface GristLoadConfig {

// In single-org mode, this is the single well-known org. Suppress any org selection UI.
singleOrg?: string;

// Url for support for the browser client to use.
helpCenterUrl?: string;

// When set, this directs the client to encode org information in path, not in domain.
pathOnly?: boolean;
Expand Down Expand Up @@ -641,6 +644,15 @@ export function getKnownOrg(): string|null {
}
}

export function getHelpCenterUrl(): string|null {
if(isClient()) {
const gristConfig: GristLoadConfig = (window as any).gristConfig;
return gristConfig && gristConfig.helpCenterUrl || null;
} else {
return process.env.GRIST_HELP_CENTER || null;
}
}

/**
* Like getKnownOrg, but respects singleOrg/GRIST_SINGLE_ORG strictly.
* The main difference in behavior would be for orgs with custom domains
Expand Down
1 change: 1 addition & 0 deletions app/server/lib/sendAppPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function makeGristConfig(homeUrl: string|null, extra: Partial<GristLoadCo
org: process.env.GRIST_SINGLE_ORG || (mreq && mreq.org),
baseDomain,
singleOrg: process.env.GRIST_SINGLE_ORG,
helpCenterUrl: process.env.GRIST_HELP_CENTER || "https://support.getgrist.com",
pathOnly,
supportAnon: shouldSupportAnon(),
supportEngines: getSupportedEngineChoices(),
Expand Down

0 comments on commit a4b1145

Please sign in to comment.