-
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moves core create object and core getLoginSystem to server/lib (#994)
This enables code in ext/ to be able to access it (e.g for proxying / interception). Additionally adds getCreate() to enable future refactoring of `const create` away from being a global singleton constant.
- Loading branch information
Showing
4 changed files
with
49 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { checkMinIOBucket, checkMinIOExternalStorage, | ||
configureMinIOExternalStorage } from 'app/server/lib/configureMinIOExternalStorage'; | ||
import { makeSimpleCreator } from 'app/server/lib/ICreate'; | ||
import { Telemetry } from 'app/server/lib/Telemetry'; | ||
|
||
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: 'Phoo2ag1jaiz6Moo2Iese2xoaphahbai3oNg7diemohlah0ohtae9iengafieS2Hae7quungoCi9iaPh', | ||
storage: [ | ||
{ | ||
name: 'minio', | ||
check: () => checkMinIOExternalStorage() !== undefined, | ||
checkBackend: () => checkMinIOBucket(), | ||
create: configureMinIOExternalStorage, | ||
}, | ||
], | ||
telemetry: { | ||
create: (dbManager, gristServer) => new Telemetry(dbManager, gristServer), | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { getForwardAuthLoginSystem } from 'app/server/lib/ForwardAuthLogin'; | ||
import { GristLoginSystem } from 'app/server/lib/GristServer'; | ||
import { getMinimalLoginSystem } from 'app/server/lib/MinimalLogin'; | ||
import { getOIDCLoginSystem } from 'app/server/lib/OIDCConfig'; | ||
import { getSamlLoginSystem } from 'app/server/lib/SamlConfig'; | ||
|
||
export async function getCoreLoginSystem(): Promise<GristLoginSystem> { | ||
return await getSamlLoginSystem() || | ||
await getOIDCLoginSystem() || | ||
await getForwardAuthLoginSystem() || | ||
await getMinimalLoginSystem(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,13 @@ | ||
import { checkMinIOBucket, checkMinIOExternalStorage, | ||
configureMinIOExternalStorage } from 'app/server/lib/configureMinIOExternalStorage'; | ||
import { makeSimpleCreator } from 'app/server/lib/ICreate'; | ||
import { Telemetry } from 'app/server/lib/Telemetry'; | ||
import {ICreate} from "app/server/lib/ICreate"; | ||
import {makeCoreCreator} from "app/server/lib/coreCreator"; | ||
|
||
export const create = makeSimpleCreator({ | ||
deploymentType: 'core', | ||
// This can and should be overridden by GRIST_SESSION_SECRET | ||
// (or generated randomly per install, like grist-omnibus does). | ||
sessionSecret: 'Phoo2ag1jaiz6Moo2Iese2xoaphahbai3oNg7diemohlah0ohtae9iengafieS2Hae7quungoCi9iaPh', | ||
storage: [ | ||
{ | ||
name: 'minio', | ||
check: () => checkMinIOExternalStorage() !== undefined, | ||
checkBackend: () => checkMinIOBucket(), | ||
create: configureMinIOExternalStorage, | ||
}, | ||
], | ||
telemetry: { | ||
create: (dbManager, gristServer) => new Telemetry(dbManager, gristServer), | ||
} | ||
}); | ||
export const create: ICreate = makeCoreCreator(); | ||
|
||
/** | ||
* Fetch the ICreate object for grist-core. | ||
* Placeholder to enable eventual refactoring away from a global singleton constant. | ||
* Needs to exist in all repositories before core can be switched! | ||
*/ | ||
export function getCreator(): ICreate { | ||
return create; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,6 @@ | ||
import { getForwardAuthLoginSystem } from 'app/server/lib/ForwardAuthLogin'; | ||
import { GristLoginSystem } from 'app/server/lib/GristServer'; | ||
import { getMinimalLoginSystem } from 'app/server/lib/MinimalLogin'; | ||
import { getOIDCLoginSystem } from 'app/server/lib/OIDCConfig'; | ||
import { getSamlLoginSystem } from 'app/server/lib/SamlConfig'; | ||
import { getCoreLoginSystem } from "app/server/lib/coreLogins"; | ||
import { GristLoginSystem } from "app/server/lib/GristServer"; | ||
|
||
export async function getLoginSystem(): Promise<GristLoginSystem> { | ||
return await getSamlLoginSystem() || | ||
await getOIDCLoginSystem() || | ||
await getForwardAuthLoginSystem() || | ||
await getMinimalLoginSystem(); | ||
return getCoreLoginSystem(); | ||
} |