diff --git a/app/server/lib/ICreate.ts b/app/server/lib/ICreate.ts index 4b4d66eeea8..9e5e55a921c 100644 --- a/app/server/lib/ICreate.ts +++ b/app/server/lib/ICreate.ts @@ -13,6 +13,9 @@ import {createSandbox, SpawnFn} from 'app/server/lib/NSandbox'; import {SqliteVariant} from 'app/server/lib/SqliteCommon'; import {ITelemetry} from 'app/server/lib/Telemetry'; +export const DEFAULT_SESSION_SECRET = + 'Phoo2ag1jaiz6Moo2Iese2xoaphahbai3oNg7diemohlah0ohtae9iengafieS2Hae7quungoCi9iaPh'; + export interface ICreate { Billing(dbManager: HomeDBManager, gristConfig: GristServer): IBilling; @@ -74,7 +77,6 @@ export interface ICreateTelemetryOptions { export function makeSimpleCreator(opts: { deploymentType: GristDeploymentType, - sessionSecret?: string, storage?: ICreateStorageOptions[], billing?: ICreateBillingOptions, notifier?: ICreateNotifierOptions, @@ -86,7 +88,7 @@ export function makeSimpleCreator(opts: { getSandboxVariants?: () => Record, createInstallAdmin?: (dbManager: HomeDBManager) => Promise, }): ICreate { - const {deploymentType, sessionSecret, storage, notifier, billing, telemetry} = opts; + const {deploymentType, storage, notifier, billing, telemetry} = opts; return { deploymentType() { return deploymentType; }, Billing(dbManager, gristConfig) { @@ -116,11 +118,7 @@ export function makeSimpleCreator(opts: { return createSandbox(opts.sandboxFlavor || 'unsandboxed', options); }, sessionSecret() { - const secret = process.env.GRIST_SESSION_SECRET || sessionSecret; - if (!secret) { - throw new Error('need GRIST_SESSION_SECRET'); - } - return secret; + return process.env.GRIST_SESSION_SECRET || DEFAULT_SESSION_SECRET; }, async configure() { for (const s of storage || []) { diff --git a/app/server/lib/coreCreator.ts b/app/server/lib/coreCreator.ts index 477c970b4d5..2eda4e9f9b6 100644 --- a/app/server/lib/coreCreator.ts +++ b/app/server/lib/coreCreator.ts @@ -3,14 +3,8 @@ import { checkMinIOBucket, checkMinIOExternalStorage, import { makeSimpleCreator } from 'app/server/lib/ICreate'; import { Telemetry } from 'app/server/lib/Telemetry'; -export const DEFAULT_SESSION_SECRET = - 'Phoo2ag1jaiz6Moo2Iese2xoaphahbai3oNg7diemohlah0ohtae9iengafieS2Hae7quungoCi9iaPh'; - export const makeCoreCreator = () => makeSimpleCreator({ deploymentType: 'core', - // This can and should be overridden by GRIST_SESSION_SECRET - // (or generated randomly per install, like grist-omnibus does). - sessionSecret: DEFAULT_SESSION_SECRET, storage: [ { name: 'minio',