Fix additional review comments

This commit is contained in:
Joel Low
2020-10-07 09:36:25 +08:00
parent 7151da64e0
commit 0bc45e0d3a
2 changed files with 9 additions and 17 deletions
+4 -1
View File
@@ -8,13 +8,16 @@ If you encounter issues while upgrading to a newer version, don't hesitate to re
> Collect changes for the next release below
### Backend (example-backend, or backends created with @backstage/create-app)
- A plugin database manager has been created, and plugins can now accept that interface as an argument during initialisation. Notably, the `auth` plugin has a [`createRouter` signature change](./plugins/auth-backend/src/service/router.ts). See [packages/backend/src/index.ts](./packages/backend/src/index.ts) on how to set it up. [#2697](https://github.com/spotify/backstage/pull/2697)
## v0.1.1-alpha.24
### Backend (example-backend, or backends created with @backstage/create-app)
- The default mount point for backend plugins have been changed to `/api`. These changes are done in the backend package itself, so it is recommended that you sync up existing backend packages with this new pattern. [#2562](https://github.com/spotify/backstage/pull/2562)
- A service discovery mechanism for backend plugins has been added, and is now a requirement for several backend plugins. See [packages/backend/src/index.ts](./packages/backend/src/index.ts) for how to set it up using `SingleHostDiscovery` from `@backstage/backend-common`. Note that the default base path for plugins is set to `/api` to that change, but it can be set to use the old behavior via the `basePath` option. [#2600](https://github.com/spotify/backstage/pull/2600)
- A plugin database manager has been created, and plugins can now accept that interface as an argument during initialisation. Notably, the `auth` plugin has a [`createRouter` signature change](./plugins/auth-backend/src/service/router.ts). See [packages/backend/src/index.ts](./packages/backend/src/index.ts) on how to set it up. [#2697](https://github.com/spotify/backstage/pull/2697)
### @backstage/auth-backend
@@ -22,11 +22,10 @@ import { PluginDatabaseManager } from './types';
/**
* Implements a Database Manager which will automatically create new databases
* for plugins when requested. All requested databases are created with the
* credentials provided.
* credentials provided; if the database already exists no attempt to create
* the database will be made.
*/
export class SingleConnectionDatabaseManager {
private readonly config: Config;
/**
* Creates a new SingleConnectionDatabaseManager instance by reading from the `backend`
* config section, specifically the `.database` key for discovering the management
@@ -40,17 +39,7 @@ export class SingleConnectionDatabaseManager {
);
}
private constructor(config: Config) {
this.config = config;
}
private getDatabaseConfig(): Config {
return this.config;
}
private getAdminConfig(): Config {
return this.config;
}
private constructor(private readonly config: Config) {}
/**
* Generates a PluginDatabaseManager for consumption by plugins.
@@ -68,7 +57,7 @@ export class SingleConnectionDatabaseManager {
}
private async getDatabase(pluginId: string): Promise<Knex> {
const config = this.getDatabaseConfig();
const config = this.config;
const overrides = SingleConnectionDatabaseManager.getDatabaseOverrides(
pluginId,
);
@@ -87,7 +76,7 @@ export class SingleConnectionDatabaseManager {
}
private async ensureDatabase(database: string) {
const config = this.getAdminConfig();
const config = this.config;
await ensureDatabaseExists(config, database);
}
}