mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
move getTemplateOrg method; enable template org in docker tests (#602)
* move getTemplateOrg method; enable template org in docker tests This moves the `getTemplateOrg` method to a neutral venue for the convenience of `grist-static`, otherwise a lot of awkward dependencies get pulled in needlessly in new parts of the app. This also fixes docker tests using the template org.
This commit is contained in:
@@ -89,6 +89,7 @@ import {Authorizer} from 'app/server/lib/Authorizer';
|
||||
import {checksumFile} from 'app/server/lib/checksumFile';
|
||||
import {Client} from 'app/server/lib/Client';
|
||||
import {DEFAULT_CACHE_TTL, DocManager} from 'app/server/lib/DocManager';
|
||||
import {getTemplateOrg} from 'app/server/lib/gristSettings';
|
||||
import {ICreateActiveDocOptions} from 'app/server/lib/ICreate';
|
||||
import {makeForkIds} from 'app/server/lib/idUtils';
|
||||
import {GRIST_DOC_SQL, GRIST_DOC_WITH_TABLE1_SQL} from 'app/server/lib/initialDocSql';
|
||||
@@ -97,7 +98,6 @@ import log from 'app/server/lib/log';
|
||||
import {LogMethods} from "app/server/lib/LogMethods";
|
||||
import {NullSandbox, UnavailableSandboxMethodError} from 'app/server/lib/NullSandbox';
|
||||
import {DocRequests} from 'app/server/lib/Requests';
|
||||
import {getTemplateOrg} from 'app/server/lib/sendAppPage';
|
||||
import {shortDesc} from 'app/server/lib/shortDesc';
|
||||
import {TableMetadataLoader} from 'app/server/lib/TableMetadataLoader';
|
||||
import {DocTriggers} from "app/server/lib/Triggers";
|
||||
|
||||
@@ -20,10 +20,11 @@ import {DocStatus, IDocWorkerMap} from 'app/server/lib/DocWorkerMap';
|
||||
import {expressWrap} from 'app/server/lib/expressWrap';
|
||||
import {DocTemplate, GristServer} from 'app/server/lib/GristServer';
|
||||
import {getCookieDomain} from 'app/server/lib/gristSessions';
|
||||
import {getTemplateOrg} from 'app/server/lib/gristSettings';
|
||||
import {getAssignmentId} from 'app/server/lib/idUtils';
|
||||
import log from 'app/server/lib/log';
|
||||
import {adaptServerUrl, addOrgToPathIfNeeded, pruneAPIResult, trustOrigin} from 'app/server/lib/requestUtils';
|
||||
import {getTemplateOrg, ISendAppPageOptions} from 'app/server/lib/sendAppPage';
|
||||
import {ISendAppPageOptions} from 'app/server/lib/sendAppPage';
|
||||
|
||||
export interface AttachOptions {
|
||||
app: express.Application; // Express app to which to add endpoints
|
||||
|
||||
13
app/server/lib/gristSettings.ts
Normal file
13
app/server/lib/gristSettings.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import {appSettings} from 'app/server/lib/AppSettings';
|
||||
|
||||
export function getTemplateOrg() {
|
||||
let org = appSettings.section('templates').flag('org').readString({
|
||||
envVar: 'GRIST_TEMPLATE_ORG',
|
||||
});
|
||||
if (!org) { return null; }
|
||||
|
||||
if (process.env.GRIST_ID_PREFIX) {
|
||||
org += `-${process.env.GRIST_ID_PREFIX}`;
|
||||
}
|
||||
return org;
|
||||
}
|
||||
@@ -3,10 +3,10 @@ import {isAffirmative} from 'app/common/gutil';
|
||||
import {getTagManagerSnippet} from 'app/common/tagManager';
|
||||
import {Document} from 'app/common/UserAPI';
|
||||
import {SUPPORT_EMAIL} from 'app/gen-server/lib/HomeDBManager';
|
||||
import {appSettings} from 'app/server/lib/AppSettings';
|
||||
import {isAnonymousUser, isSingleUserMode, RequestWithLogin} from 'app/server/lib/Authorizer';
|
||||
import {RequestWithOrg} from 'app/server/lib/extractOrg';
|
||||
import {GristServer} from 'app/server/lib/GristServer';
|
||||
import {getTemplateOrg} from 'app/server/lib/gristSettings';
|
||||
import {getSupportedEngineChoices} from 'app/server/lib/serverUtils';
|
||||
import {readLoadedLngs, readLoadedNamespaces} from 'app/server/localization';
|
||||
import * as express from 'express';
|
||||
@@ -154,18 +154,6 @@ export function makeSendAppPage(opts: {
|
||||
};
|
||||
}
|
||||
|
||||
export function getTemplateOrg() {
|
||||
let org = appSettings.section('templates').flag('org').readString({
|
||||
envVar: 'GRIST_TEMPLATE_ORG',
|
||||
});
|
||||
if (!org) { return null; }
|
||||
|
||||
if (process.env.GRIST_ID_PREFIX) {
|
||||
org += `-${process.env.GRIST_ID_PREFIX}`;
|
||||
}
|
||||
return org;
|
||||
}
|
||||
|
||||
function shouldSupportAnon() {
|
||||
// Enable UI for anonymous access if a flag is explicitly set in the environment
|
||||
return process.env.GRIST_SUPPORT_ANON === "true";
|
||||
|
||||
Reference in New Issue
Block a user