@backstage/create-app 0.0.0-nightly-2021102622333 → 0.0.0-nightly-2021102722415
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -3
- package/package.json +1 -1
- package/templates/default-app/app-config.yaml.hbs +5 -0
- package/templates/default-app/packages/backend/src/index.ts +3 -1
- package/templates/default-app/packages/backend/src/plugins/search.ts +10 -2
- package/templates/default-app/packages/backend/src/types.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,65 @@
|
|
|
1
1
|
# @backstage/create-app
|
|
2
2
|
|
|
3
|
-
## 0.0.0-nightly-
|
|
3
|
+
## 0.0.0-nightly-2021102722415
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
+
- 905dd952ac: Incorporate usage of the tokenManager into the backend created using `create-app`.
|
|
8
|
+
|
|
9
|
+
In existing backends, update the `PluginEnvironment` to include a `tokenManager`:
|
|
10
|
+
|
|
11
|
+
```diff
|
|
12
|
+
// packages/backend/src/types.ts
|
|
13
|
+
|
|
14
|
+
...
|
|
15
|
+
import {
|
|
16
|
+
...
|
|
17
|
+
+ TokenManager,
|
|
18
|
+
} from '@backstage/backend-common';
|
|
19
|
+
|
|
20
|
+
export type PluginEnvironment = {
|
|
21
|
+
...
|
|
22
|
+
+ tokenManager: TokenManager;
|
|
23
|
+
};
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then, create a `ServerTokenManager`. This can either be a `noop` that requires no secret and validates all requests by default, or one that uses a secret from your `app-config.yaml` to generate and validate tokens.
|
|
27
|
+
|
|
28
|
+
```diff
|
|
29
|
+
// packages/backend/src/index.ts
|
|
30
|
+
|
|
31
|
+
...
|
|
32
|
+
import {
|
|
33
|
+
...
|
|
34
|
+
+ ServerTokenManager,
|
|
35
|
+
} from '@backstage/backend-common';
|
|
36
|
+
...
|
|
37
|
+
|
|
38
|
+
function makeCreateEnv(config: Config) {
|
|
39
|
+
...
|
|
40
|
+
// CHOOSE ONE
|
|
41
|
+
// TokenManager not requiring a secret
|
|
42
|
+
+ const tokenManager = ServerTokenManager.noop();
|
|
43
|
+
// OR TokenManager requiring a secret
|
|
44
|
+
+ const tokenManager = ServerTokenManager.fromConfig(config);
|
|
45
|
+
|
|
46
|
+
...
|
|
47
|
+
return (plugin: string): PluginEnvironment => {
|
|
48
|
+
...
|
|
49
|
+
- return { logger, cache, database, config, reader, discovery };
|
|
50
|
+
+ return { logger, cache, database, config, reader, discovery, tokenManager };
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
7
55
|
- Updated dependencies
|
|
8
|
-
- @backstage/
|
|
9
|
-
- @backstage/
|
|
56
|
+
- @backstage/plugin-auth-backend@0.0.0-nightly-2021102722415
|
|
57
|
+
- @backstage/plugin-catalog-backend@0.0.0-nightly-2021102722415
|
|
58
|
+
- @backstage/plugin-scaffolder-backend@0.0.0-nightly-2021102722415
|
|
59
|
+
- @backstage/plugin-techdocs-backend@0.0.0-nightly-2021102722415
|
|
60
|
+
- @backstage/backend-common@0.0.0-nightly-2021102722415
|
|
61
|
+
- @backstage/cli@0.0.0-nightly-2021102722415
|
|
62
|
+
- @backstage/core-plugin-api@0.0.0-nightly-2021102722415
|
|
10
63
|
|
|
11
64
|
## 0.4.5
|
|
12
65
|
|
package/package.json
CHANGED
|
@@ -6,6 +6,11 @@ organization:
|
|
|
6
6
|
name: My Company
|
|
7
7
|
|
|
8
8
|
backend:
|
|
9
|
+
# Used for enabling authentication, secret is shared by all backend plugins
|
|
10
|
+
# See backend-to-backend-auth.md in the docs for information on the format
|
|
11
|
+
# auth:
|
|
12
|
+
# keys:
|
|
13
|
+
# - secret: ${BACKEND_SECRET}
|
|
9
14
|
baseUrl: http://localhost:7007
|
|
10
15
|
listen:
|
|
11
16
|
port: 7007
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
DatabaseManager,
|
|
18
18
|
SingleHostDiscovery,
|
|
19
19
|
UrlReaders,
|
|
20
|
+
ServerTokenManager,
|
|
20
21
|
} from '@backstage/backend-common';
|
|
21
22
|
import { Config } from '@backstage/config';
|
|
22
23
|
import app from './plugins/app';
|
|
@@ -37,12 +38,13 @@ function makeCreateEnv(config: Config) {
|
|
|
37
38
|
|
|
38
39
|
const cacheManager = CacheManager.fromConfig(config);
|
|
39
40
|
const databaseManager = DatabaseManager.fromConfig(config);
|
|
41
|
+
const tokenManager = ServerTokenManager.noop();
|
|
40
42
|
|
|
41
43
|
return (plugin: string): PluginEnvironment => {
|
|
42
44
|
const logger = root.child({ type: 'plugin', plugin });
|
|
43
45
|
const database = databaseManager.forPlugin(plugin);
|
|
44
46
|
const cache = cacheManager.forPlugin(plugin);
|
|
45
|
-
return { logger, database, cache, config, reader, discovery };
|
|
47
|
+
return { logger, database, cache, config, reader, discovery, tokenManager };
|
|
46
48
|
};
|
|
47
49
|
}
|
|
48
50
|
|
|
@@ -12,6 +12,7 @@ export default async function createPlugin({
|
|
|
12
12
|
logger,
|
|
13
13
|
discovery,
|
|
14
14
|
config,
|
|
15
|
+
tokenManager,
|
|
15
16
|
}: PluginEnvironment) {
|
|
16
17
|
// Initialize a connection to a search engine.
|
|
17
18
|
const searchEngine = new LunrSearchEngine({ logger });
|
|
@@ -21,13 +22,20 @@ export default async function createPlugin({
|
|
|
21
22
|
// collator gathers entities from the software catalog.
|
|
22
23
|
indexBuilder.addCollator({
|
|
23
24
|
defaultRefreshIntervalSeconds: 600,
|
|
24
|
-
collator: DefaultCatalogCollator.fromConfig(config, {
|
|
25
|
+
collator: DefaultCatalogCollator.fromConfig(config, {
|
|
26
|
+
discovery,
|
|
27
|
+
tokenManager,
|
|
28
|
+
}),
|
|
25
29
|
});
|
|
26
30
|
|
|
27
31
|
// collator gathers entities from techdocs.
|
|
28
32
|
indexBuilder.addCollator({
|
|
29
33
|
defaultRefreshIntervalSeconds: 600,
|
|
30
|
-
collator: DefaultTechDocsCollator.fromConfig(config, {
|
|
34
|
+
collator: DefaultTechDocsCollator.fromConfig(config, {
|
|
35
|
+
discovery,
|
|
36
|
+
logger,
|
|
37
|
+
tokenManager,
|
|
38
|
+
}),
|
|
31
39
|
});
|
|
32
40
|
|
|
33
41
|
// The scheduler controls when documents are gathered from collators and sent
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
PluginCacheManager,
|
|
5
5
|
PluginDatabaseManager,
|
|
6
6
|
PluginEndpointDiscovery,
|
|
7
|
+
TokenManager,
|
|
7
8
|
UrlReader,
|
|
8
9
|
} from '@backstage/backend-common';
|
|
9
10
|
|
|
@@ -14,4 +15,5 @@ export type PluginEnvironment = {
|
|
|
14
15
|
config: Config;
|
|
15
16
|
reader: UrlReader;
|
|
16
17
|
discovery: PluginEndpointDiscovery;
|
|
18
|
+
tokenManager: TokenManager;
|
|
17
19
|
};
|