@backstage/backend-defaults 0.8.2-next.1 → 0.8.2-next.2
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 +21 -0
- package/config.d.ts +1 -1
- package/dist/database.d.ts +0 -1
- package/dist/entrypoints/discovery/HostDiscovery.cjs.js +3 -8
- package/dist/entrypoints/discovery/HostDiscovery.cjs.js.map +1 -1
- package/dist/httpRouter.d.ts +0 -1
- package/dist/package.json.cjs.js +1 -1
- package/dist/rootHttpRouter.d.ts +0 -2
- package/dist/urlReader.d.ts +0 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @backstage/backend-defaults
|
|
2
2
|
|
|
3
|
+
## 0.8.2-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 12f8e01: The `discovery.endpoints` configuration no longer requires both `internal` and `external` target when using the object form, instead falling back to the default.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/config-loader@1.10.0-next.0
|
|
10
|
+
- @backstage/integration@1.16.2-next.0
|
|
11
|
+
- @backstage/plugin-events-node@0.4.9-next.2
|
|
12
|
+
- @backstage/backend-app-api@1.2.1-next.2
|
|
13
|
+
- @backstage/backend-dev-utils@0.1.5
|
|
14
|
+
- @backstage/backend-plugin-api@1.2.1-next.1
|
|
15
|
+
- @backstage/cli-common@0.1.15
|
|
16
|
+
- @backstage/cli-node@0.2.13
|
|
17
|
+
- @backstage/config@1.3.2
|
|
18
|
+
- @backstage/errors@1.2.7
|
|
19
|
+
- @backstage/integration-aws-node@0.1.15
|
|
20
|
+
- @backstage/types@1.2.1
|
|
21
|
+
- @backstage/plugin-auth-node@0.6.1-next.1
|
|
22
|
+
- @backstage/plugin-permission-node@0.8.9-next.1
|
|
23
|
+
|
|
3
24
|
## 0.8.2-next.1
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/config.d.ts
CHANGED
|
@@ -652,7 +652,7 @@ export interface Config {
|
|
|
652
652
|
* Can be either a string or an object with internal and external keys.
|
|
653
653
|
* Targets with `{{pluginId}}` or `{{ pluginId }} in the URL will be replaced with the plugin ID.
|
|
654
654
|
*/
|
|
655
|
-
target: string | { internal
|
|
655
|
+
target: string | { internal?: string; external?: string };
|
|
656
656
|
/**
|
|
657
657
|
* Array of plugins which use the target base URL.
|
|
658
658
|
*/
|
package/dist/database.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
3
2
|
import { DatabaseService, RootLoggerService, RootLifecycleService, RootConfigService, LoggerService, LifecycleService } from '@backstage/backend-plugin-api';
|
|
4
3
|
|
|
@@ -58,18 +58,13 @@ class HostDiscovery {
|
|
|
58
58
|
}
|
|
59
59
|
getTargetFromConfig(pluginId, type) {
|
|
60
60
|
const endpoints = this.discoveryConfig?.getOptionalConfigArray("endpoints");
|
|
61
|
-
const
|
|
61
|
+
const targetOrObj = endpoints?.find((endpoint) => endpoint.getStringArray("plugins").includes(pluginId))?.get("target");
|
|
62
|
+
const target = typeof targetOrObj === "string" ? targetOrObj : targetOrObj?.[type];
|
|
62
63
|
if (!target) {
|
|
63
64
|
const baseUrl = type === "external" ? this.externalBaseUrl : this.internalBaseUrl;
|
|
64
65
|
return `${baseUrl}/${encodeURIComponent(pluginId)}`;
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
-
return target.replace(
|
|
68
|
-
/\{\{\s*pluginId\s*\}\}/g,
|
|
69
|
-
encodeURIComponent(pluginId)
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
return target[type].replace(
|
|
67
|
+
return target.replace(
|
|
73
68
|
/\{\{\s*pluginId\s*\}\}/g,
|
|
74
69
|
encodeURIComponent(pluginId)
|
|
75
70
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HostDiscovery.cjs.js","sources":["../../../src/entrypoints/discovery/HostDiscovery.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport {\n DiscoveryService,\n RootConfigService,\n} from '@backstage/backend-plugin-api';\nimport { readHttpServerOptions } from '../rootHttpRouter/http/config';\n\ntype Target = string | { internal: string; external: string };\n\n/**\n * HostDiscovery is a basic DiscoveryService implementation\n * that can handle plugins that are hosted in a single or multiple deployments.\n *\n * The deployment may be scaled horizontally, as long as the external URL\n * is the same for all instances. However, internal URLs will always be\n * resolved to the same host, so there won't be any balancing of internal traffic.\n *\n * @public\n */\nexport class HostDiscovery implements DiscoveryService {\n /**\n * Creates a new HostDiscovery discovery instance by reading\n * from the `backend` config section, specifically the `.baseUrl` for\n * discovering the external URL, and the `.listen` and `.https` config\n * for the internal one.\n *\n * Can be overridden in config by providing a target and corresponding plugins in `discovery.endpoints`.\n * eg.\n *\n * ```yaml\n * discovery:\n * endpoints:\n * - target: https://internal.example.com/internal-catalog\n * plugins: [catalog]\n * - target: https://internal.example.com/secure/api/{{pluginId}}\n * plugins: [auth, permission]\n * - target:\n * internal: https://internal.example.com/search\n * external: https://example.com/search\n * plugins: [search]\n * ```\n *\n * The fixed base path is `/api`, meaning the default full internal\n * path for the `catalog` plugin will be `http://localhost:7007/api/catalog`.\n */\n static fromConfig(config: RootConfigService) {\n const basePath = '/api';\n const externalBaseUrl = config\n .getString('backend.baseUrl')\n .replace(/\\/+$/, '');\n\n const {\n listen: { host: listenHost = '::', port: listenPort },\n } = readHttpServerOptions(config.getConfig('backend'));\n const protocol = config.has('backend.https') ? 'https' : 'http';\n\n // Translate bind-all to localhost, and support IPv6\n let host = listenHost;\n if (host === '::' || host === '') {\n // We use localhost instead of ::1, since IPv6-compatible systems should default\n // to using IPv6 when they see localhost, but if the system doesn't support IPv6\n // things will still work.\n host = 'localhost';\n } else if (host === '0.0.0.0') {\n host = '127.0.0.1';\n }\n if (host.includes(':')) {\n host = `[${host}]`;\n }\n\n const internalBaseUrl = `${protocol}://${host}:${listenPort}`;\n\n return new HostDiscovery(\n internalBaseUrl + basePath,\n externalBaseUrl + basePath,\n config.getOptionalConfig('discovery'),\n );\n }\n\n private constructor(\n private readonly internalBaseUrl: string,\n private readonly externalBaseUrl: string,\n private readonly discoveryConfig: Config | undefined,\n ) {}\n\n private getTargetFromConfig(pluginId: string, type: 'internal' | 'external') {\n const endpoints = this.discoveryConfig?.getOptionalConfigArray('endpoints');\n\n const
|
|
1
|
+
{"version":3,"file":"HostDiscovery.cjs.js","sources":["../../../src/entrypoints/discovery/HostDiscovery.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport {\n DiscoveryService,\n RootConfigService,\n} from '@backstage/backend-plugin-api';\nimport { readHttpServerOptions } from '../rootHttpRouter/http/config';\n\ntype Target = string | { internal: string; external: string };\n\n/**\n * HostDiscovery is a basic DiscoveryService implementation\n * that can handle plugins that are hosted in a single or multiple deployments.\n *\n * The deployment may be scaled horizontally, as long as the external URL\n * is the same for all instances. However, internal URLs will always be\n * resolved to the same host, so there won't be any balancing of internal traffic.\n *\n * @public\n */\nexport class HostDiscovery implements DiscoveryService {\n /**\n * Creates a new HostDiscovery discovery instance by reading\n * from the `backend` config section, specifically the `.baseUrl` for\n * discovering the external URL, and the `.listen` and `.https` config\n * for the internal one.\n *\n * Can be overridden in config by providing a target and corresponding plugins in `discovery.endpoints`.\n * eg.\n *\n * ```yaml\n * discovery:\n * endpoints:\n * - target: https://internal.example.com/internal-catalog\n * plugins: [catalog]\n * - target: https://internal.example.com/secure/api/{{pluginId}}\n * plugins: [auth, permission]\n * - target:\n * internal: https://internal.example.com/search\n * external: https://example.com/search\n * plugins: [search]\n * ```\n *\n * The fixed base path is `/api`, meaning the default full internal\n * path for the `catalog` plugin will be `http://localhost:7007/api/catalog`.\n */\n static fromConfig(config: RootConfigService) {\n const basePath = '/api';\n const externalBaseUrl = config\n .getString('backend.baseUrl')\n .replace(/\\/+$/, '');\n\n const {\n listen: { host: listenHost = '::', port: listenPort },\n } = readHttpServerOptions(config.getConfig('backend'));\n const protocol = config.has('backend.https') ? 'https' : 'http';\n\n // Translate bind-all to localhost, and support IPv6\n let host = listenHost;\n if (host === '::' || host === '') {\n // We use localhost instead of ::1, since IPv6-compatible systems should default\n // to using IPv6 when they see localhost, but if the system doesn't support IPv6\n // things will still work.\n host = 'localhost';\n } else if (host === '0.0.0.0') {\n host = '127.0.0.1';\n }\n if (host.includes(':')) {\n host = `[${host}]`;\n }\n\n const internalBaseUrl = `${protocol}://${host}:${listenPort}`;\n\n return new HostDiscovery(\n internalBaseUrl + basePath,\n externalBaseUrl + basePath,\n config.getOptionalConfig('discovery'),\n );\n }\n\n private constructor(\n private readonly internalBaseUrl: string,\n private readonly externalBaseUrl: string,\n private readonly discoveryConfig: Config | undefined,\n ) {}\n\n private getTargetFromConfig(pluginId: string, type: 'internal' | 'external') {\n const endpoints = this.discoveryConfig?.getOptionalConfigArray('endpoints');\n\n const targetOrObj = endpoints\n ?.find(endpoint => endpoint.getStringArray('plugins').includes(pluginId))\n ?.get<Target>('target');\n\n const target =\n typeof targetOrObj === 'string' ? targetOrObj : targetOrObj?.[type];\n\n if (!target) {\n const baseUrl =\n type === 'external' ? this.externalBaseUrl : this.internalBaseUrl;\n\n return `${baseUrl}/${encodeURIComponent(pluginId)}`;\n }\n\n return target.replace(\n /\\{\\{\\s*pluginId\\s*\\}\\}/g,\n encodeURIComponent(pluginId),\n );\n }\n\n async getBaseUrl(pluginId: string): Promise<string> {\n return this.getTargetFromConfig(pluginId, 'internal');\n }\n\n async getExternalBaseUrl(pluginId: string): Promise<string> {\n return this.getTargetFromConfig(pluginId, 'external');\n }\n}\n"],"names":["config","readHttpServerOptions"],"mappings":";;;;AAmCO,MAAM,aAA0C,CAAA;AAAA,EA4D7C,WAAA,CACW,eACA,EAAA,eAAA,EACA,eACjB,EAAA;AAHiB,IAAA,IAAA,CAAA,eAAA,GAAA,eAAA;AACA,IAAA,IAAA,CAAA,eAAA,GAAA,eAAA;AACA,IAAA,IAAA,CAAA,eAAA,GAAA,eAAA;AAAA;AAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAtCH,OAAO,WAAWA,QAA2B,EAAA;AAC3C,IAAA,MAAM,QAAW,GAAA,MAAA;AACjB,IAAA,MAAM,kBAAkBA,QACrB,CAAA,SAAA,CAAU,iBAAiB,CAC3B,CAAA,OAAA,CAAQ,QAAQ,EAAE,CAAA;AAErB,IAAM,MAAA;AAAA,MACJ,QAAQ,EAAE,IAAA,EAAM,UAAa,GAAA,IAAA,EAAM,MAAM,UAAW;AAAA,KAClD,GAAAC,4BAAA,CAAsBD,QAAO,CAAA,SAAA,CAAU,SAAS,CAAC,CAAA;AACrD,IAAA,MAAM,QAAW,GAAAA,QAAA,CAAO,GAAI,CAAA,eAAe,IAAI,OAAU,GAAA,MAAA;AAGzD,IAAA,IAAI,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;AAAA,MACA,mBAAmB,QAAQ;AAAA,KAC7B;AAAA;AACF,EAEA,MAAM,WAAW,QAAmC,EAAA;AAClD,IAAO,OAAA,IAAA,CAAK,mBAAoB,CAAA,QAAA,EAAU,UAAU,CAAA;AAAA;AACtD,EAEA,MAAM,mBAAmB,QAAmC,EAAA;AAC1D,IAAO,OAAA,IAAA,CAAK,mBAAoB,CAAA,QAAA,EAAU,UAAU,CAAA;AAAA;AAExD;;;;"}
|
package/dist/httpRouter.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="express" />
|
|
2
1
|
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
3
2
|
import { AuthService, HttpAuthService, RootConfigService, HttpRouterServiceAuthPolicy, LifecycleService } from '@backstage/backend-plugin-api';
|
|
4
3
|
import * as express from 'express';
|
package/dist/package.json.cjs.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var name = "@backstage/backend-defaults";
|
|
6
|
-
var version = "0.8.2-next.
|
|
6
|
+
var version = "0.8.2-next.2";
|
|
7
7
|
var description = "Backend defaults used by Backstage backend apps";
|
|
8
8
|
var backstage = {
|
|
9
9
|
role: "node-library"
|
package/dist/rootHttpRouter.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="express" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
4
2
|
import { RootHttpRouterService, RootHealthService, RootConfigService, LoggerService, LifecycleService } from '@backstage/backend-plugin-api';
|
|
5
3
|
import * as express from 'express';
|
package/dist/urlReader.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
3
2
|
import { UrlReaderService, RootConfigService, LoggerService, UrlReaderServiceReadTreeResponse, UrlReaderServiceReadUrlOptions, UrlReaderServiceReadUrlResponse, UrlReaderServiceReadTreeOptions, UrlReaderServiceSearchOptions, UrlReaderServiceSearchResponse } from '@backstage/backend-plugin-api';
|
|
4
3
|
import { AzureIntegration, AzureDevOpsCredentialsProvider, BitbucketCloudIntegration, BitbucketIntegration, BitbucketServerIntegration, GerritIntegration, GithubIntegration, GithubCredentialsProvider, GitLabIntegration, GiteaIntegration, HarnessIntegration, AwsS3Integration, AzureCredentialsManager, AzureBlobStorageIntergation } from '@backstage/integration';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/backend-defaults",
|
|
3
|
-
"version": "0.8.2-next.
|
|
3
|
+
"version": "0.8.2-next.2",
|
|
4
4
|
"description": "Backend defaults used by Backstage backend apps",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "node-library"
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"types": "./dist/index.d.ts",
|
|
126
126
|
"typesVersions": {
|
|
127
127
|
"*": {
|
|
128
|
-
"
|
|
128
|
+
"*": [
|
|
129
129
|
"dist/index.d.ts"
|
|
130
130
|
],
|
|
131
131
|
"auditor": [
|
|
@@ -209,18 +209,18 @@
|
|
|
209
209
|
"@aws-sdk/types": "^3.347.0",
|
|
210
210
|
"@azure/identity": "^4.0.0",
|
|
211
211
|
"@azure/storage-blob": "^12.5.0",
|
|
212
|
-
"@backstage/backend-app-api": "1.2.1-next.
|
|
212
|
+
"@backstage/backend-app-api": "1.2.1-next.2",
|
|
213
213
|
"@backstage/backend-dev-utils": "0.1.5",
|
|
214
214
|
"@backstage/backend-plugin-api": "1.2.1-next.1",
|
|
215
215
|
"@backstage/cli-common": "0.1.15",
|
|
216
216
|
"@backstage/cli-node": "0.2.13",
|
|
217
217
|
"@backstage/config": "1.3.2",
|
|
218
|
-
"@backstage/config-loader": "1.
|
|
218
|
+
"@backstage/config-loader": "1.10.0-next.0",
|
|
219
219
|
"@backstage/errors": "1.2.7",
|
|
220
|
-
"@backstage/integration": "1.16.
|
|
220
|
+
"@backstage/integration": "1.16.2-next.0",
|
|
221
221
|
"@backstage/integration-aws-node": "0.1.15",
|
|
222
222
|
"@backstage/plugin-auth-node": "0.6.1-next.1",
|
|
223
|
-
"@backstage/plugin-events-node": "0.4.9-next.
|
|
223
|
+
"@backstage/plugin-events-node": "0.4.9-next.2",
|
|
224
224
|
"@backstage/plugin-permission-node": "0.8.9-next.1",
|
|
225
225
|
"@backstage/types": "1.2.1",
|
|
226
226
|
"@google-cloud/storage": "^7.0.0",
|
|
@@ -276,8 +276,8 @@
|
|
|
276
276
|
"devDependencies": {
|
|
277
277
|
"@aws-sdk/util-stream-node": "^3.350.0",
|
|
278
278
|
"@backstage/backend-plugin-api": "1.2.1-next.1",
|
|
279
|
-
"@backstage/backend-test-utils": "1.3.1-next.
|
|
280
|
-
"@backstage/cli": "0.
|
|
279
|
+
"@backstage/backend-test-utils": "1.3.1-next.2",
|
|
280
|
+
"@backstage/cli": "0.31.0-next.1",
|
|
281
281
|
"@google-cloud/cloud-sql-connector": "^1.4.0",
|
|
282
282
|
"@types/archiver": "^6.0.0",
|
|
283
283
|
"@types/base64-stream": "^1.0.2",
|