diff --git a/app/server/lib/BootProbes.ts b/app/server/lib/BootProbes.ts index adef4811..36c3786c 100644 --- a/app/server/lib/BootProbes.ts +++ b/app/server/lib/BootProbes.ts @@ -6,7 +6,7 @@ import { GristServer } from 'app/server/lib/GristServer'; import * as express from 'express'; import WS from 'ws'; import fetch from 'node-fetch'; -import { DEFAULT_SESSION_SECRET } from 'app/server/lib/coreCreator'; +import { DEFAULT_SESSION_SECRET } from 'app/server/lib/ICreate'; /** * Self-diagnostics useful when installing Grist. diff --git a/app/server/lib/ICreate.ts b/app/server/lib/ICreate.ts index 4b4d66ee..bf6fa69d 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; @@ -116,11 +119,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 || sessionSecret || 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 477c970b..2eda4e9f 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',