From 0335104813eef073f3bed3b49580e10ab36333d0 Mon Sep 17 00:00:00 2001 From: Kristaps Fabians Geikins Date: Tue, 29 Oct 2024 14:13:03 +0200 Subject: [PATCH] config adjustment --- .../modules/multiregion/domain/operations.ts | 4 +++- .../modules/multiregion/domain/types.ts | 19 ++++++++++--------- .../modules/multiregion/services/config.ts | 12 +++++++----- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/packages/server/modules/multiregion/domain/operations.ts b/packages/server/modules/multiregion/domain/operations.ts index 96be74b94..d54e10066 100644 --- a/packages/server/modules/multiregion/domain/operations.ts +++ b/packages/server/modules/multiregion/domain/operations.ts @@ -1,3 +1,5 @@ import { RegionServerConfig } from '@/modules/multiregion/domain/types' -export type GetAvailableRegionConfigs = () => Promise +export type GetAvailableRegionConfigs = () => Promise<{ + [key: string]: RegionServerConfig +}> diff --git a/packages/server/modules/multiregion/domain/types.ts b/packages/server/modules/multiregion/domain/types.ts index 45563be3b..036064059 100644 --- a/packages/server/modules/multiregion/domain/types.ts +++ b/packages/server/modules/multiregion/domain/types.ts @@ -1,11 +1,12 @@ -// TODO: Need to coordinate w/ Iain on how this is actually gonna work export type RegionServerConfig = { - /** - * Full Postgres connection URI (e.g. "postgres://user:password@host:port/dbname") - */ - connectionUri: string - /** - * Acts as a key, needs to be globally unique - */ - locale: string + postgres: { + /** + * Full Postgres connection URI (e.g. "postgres://user:password@host:port/dbname") + */ + connectionUri: string + /** + * SSL cert, if any + */ + publicTlsCertificate?: string + } } diff --git a/packages/server/modules/multiregion/services/config.ts b/packages/server/modules/multiregion/services/config.ts index 13d5c69dd..13c9eb5e9 100644 --- a/packages/server/modules/multiregion/services/config.ts +++ b/packages/server/modules/multiregion/services/config.ts @@ -3,10 +3,12 @@ import { GetAvailableRegionConfigs } from '@/modules/multiregion/domain/operatio export const getAvailableRegionConfigsFactory = (): GetAvailableRegionConfigs => async () => { // TODO: Hardcoded for now, should be fetched from a config file - return [ - { - locale: 'eu', - connectionUri: 'postgresql://speckle:speckle@localhost/speckle_eu' + return { + eu: { + postgres: { + connectionUri: 'postgresql://speckle:speckle@localhost/speckle_eu', + publicTlsCertificate: undefined + } } - ] + } }