Fix review comments

- Combine the various exported types; the only API surface is now the
  `PluginDatabaseClientFactory` which is a free function.
- Rename to the SingleConnectionManager class.
- Refactor the PluginEnvironment type to use databaseClientFactory for
  clarity.
- Fix mergeDatabaseConfig to not override the input dictionary.
This commit is contained in:
Joel Low
2020-10-02 12:35:40 +08:00
parent e277c5dfa5
commit 8c78b4e9dd
15 changed files with 78 additions and 119 deletions
+3 -3
View File
@@ -24,12 +24,12 @@ import { DatabaseKeyStore, TokenFactory, createOidcRouter } from '../identity';
import {
NotFoundError,
PluginEndpointDiscovery,
PluginDatabaseFactory,
PluginDatabaseClientFactory,
} from '@backstage/backend-common';
export interface RouterOptions {
logger: Logger;
database: PluginDatabaseFactory;
database: PluginDatabaseClientFactory;
config: Config;
discovery: PluginEndpointDiscovery;
}
@@ -48,7 +48,7 @@ export async function createRouter({
const keyDurationSeconds = 3600;
const keyStore = await DatabaseKeyStore.create({
database: await database.getDatabase(),
database: await database(),
});
const tokenIssuer = new TokenFactory({
issuer: authUrl,
@@ -53,10 +53,8 @@ export async function startStandaloneServer(
const router = await createRouter({
logger,
config,
database: {
async getDatabase(_database?: string) {
return database;
},
database: async () => {
return database;
},
discovery,
});