Skip to content

Commit

Permalink
feat: removed baseUrl
Browse files Browse the repository at this point in the history
BREAKING CHANGE: removed baseUrl and proxyPath
  • Loading branch information
antoniomuso committed Jan 23, 2023
1 parent 7ea418b commit 55289a4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ export const apis: AnyApiFactory[] = [
factory: ({ configApi, discoveryApi }) =>
CustomGitlabCIClient.setupAPI({
discoveryApi,
baseUrl: configApi.getOptionalString('gitlab.baseUrl'),
codeOwnersPath: configApi.getOptionalString(
'gitlab.defaultCodeOwnersPath'
),
Expand Down
28 changes: 28 additions & 0 deletions docs/migration-guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,31 @@ gitlab:
# Default: ['Component']
allowedKinds: ['Component', `Resource`]
```

6. If you have extended the GitLab API for the support of a new or old GitLab version:

`packages/app/src/api.ts`

```diff
import { GitlabCIApiRef } from '@immobiliarelabs/backstage-plugin-gitlab';
import { CustomGitlabCIClient } from '@immobiliarelabs/backstage-plugin-gitlab';
import { discoveryApiRef, configApiRef } from '@backstage/core-plugin-api';
import { CustomGitlabCIClient } from 'packages/app/src/myCustomClient.ts';

export const apis: AnyApiFactory[] = [
createApiFactory({
api: GitlabCIApiRef,
deps: { configApi: configApiRef, discoveryApi: discoveryApiRef },
factory: ({ configApi, discoveryApi }) =>
- new CustomGitlabCIClient({
+ CustomGitlabCIClient.setupAPI({
discoveryApi,
- baseUrl: configApi.getOptionalString('gitlab.baseUrl'),
- proxyPath: configApi.getOptionalString('gitlab.proxyPath'),
codeOwnersPath: configApi.getOptionalString(
'gitlab.defaultCodeOwnersPath'
),
}),
}),
];
```
6 changes: 0 additions & 6 deletions packages/gitlab/src/api/GitlabCIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,25 @@ import {

export class GitlabCIClient implements GitlabCIApi {
discoveryApi: DiscoveryApi;
baseUrl: string;
codeOwnersPath: string;
gitlabInstance: string;

constructor({
discoveryApi,
baseUrl = 'https://gitlab.com/',
codeOwnersPath,
gitlabInstance,
}: {
discoveryApi: DiscoveryApi;
baseUrl?: string;
codeOwnersPath?: string;
gitlabInstance: string;
}) {
this.discoveryApi = discoveryApi;
this.baseUrl = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`;
this.codeOwnersPath = codeOwnersPath || 'CODEOWNERS';
this.gitlabInstance = gitlabInstance;
}

static setupAPI({
discoveryApi,
baseUrl = 'https://gitlab.com/',
codeOwnersPath,
}: {
discoveryApi: DiscoveryApi;
Expand All @@ -53,7 +48,6 @@ export class GitlabCIClient implements GitlabCIApi {
build: (gitlabInstance: string) =>
new this({
discoveryApi,
baseUrl,
codeOwnersPath,
gitlabInstance,
}),
Expand Down
1 change: 0 additions & 1 deletion packages/gitlab/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export const gitlabPlugin = createPlugin({
factory: ({ configApi, discoveryApi }) =>
GitlabCIClient.setupAPI({
discoveryApi,
baseUrl: configApi.getOptionalString('gitlab.baseUrl'),
codeOwnersPath: configApi.getOptionalString(
'gitlab.defaultCodeOwnersPath'
),
Expand Down

0 comments on commit 55289a4

Please sign in to comment.