diff --git a/app/server/lib/FlexServer.ts b/app/server/lib/FlexServer.ts index 72a55f13..1aa73ea2 100644 --- a/app/server/lib/FlexServer.ts +++ b/app/server/lib/FlexServer.ts @@ -1132,9 +1132,6 @@ export class FlexServer implements GristServer { await this.loadConfig(); this.addComm(); - // Temporary duplication of external storage configuration. - // This may break https://github.com/gristlabs/grist-core/pull/546, - // but will revive other uses of external storage. TODO: reconcile. await this.create.configure?.(); if (!isSingleUserMode()) { @@ -1147,7 +1144,7 @@ export class FlexServer implements GristServer { this._disableExternalStorage = true; externalStorage.flag('active').set(false); } - await this.create.configure?.(); + await this.create.checkBackend?.(); const workers = this._docWorkerMap; const docWorkerId = await this._addSelfAsWorker(workers); diff --git a/app/server/lib/ICreate.ts b/app/server/lib/ICreate.ts index f876fa9c..73b76e5c 100644 --- a/app/server/lib/ICreate.ts +++ b/app/server/lib/ICreate.ts @@ -32,6 +32,8 @@ export interface ICreate { sessionSecret(): string; // Check configuration of the app early enough to show on startup. configure?(): Promise; + // Optionally perform sanity checks on the configured storage, throwing a fatal error if it is not functional + checkBackend?(): Promise; // Return a string containing 1 or more HTML tags to insert into the head element of every // static page. getExtraHeadHtml?(): string; @@ -119,6 +121,13 @@ export function makeSimpleCreator(opts: { return secret; }, async configure() { + for (const s of storage || []) { + if (s.check()) { + break; + } + } + }, + async checkBackend() { for (const s of storage || []) { if (s.check()) { await s.checkBackend?.();