File tree Expand file tree Collapse file tree 3 files changed +6
-12
lines changed
plugins/backstage-plugin-coder/src Expand file tree Collapse file tree 3 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ export class CoderClient implements CoderClientApi {
100
100
this . cleanupController = new AbortController ( ) ;
101
101
this . trackedEjectionIds = new Set ( ) ;
102
102
103
- this . sdk = this . getBackstageCoderSdk ( ) ;
103
+ this . sdk = this . createBackstageCoderSdk ( ) ;
104
104
this . addBaseRequestInterceptors ( ) ;
105
105
}
106
106
@@ -181,7 +181,7 @@ export class CoderClient implements CoderClientApi {
181
181
this . addRequestInterceptor ( baseRequestInterceptor , baseErrorInterceptor ) ;
182
182
}
183
183
184
- private getBackstageCoderSdk ( ) : BackstageCoderSdk {
184
+ private createBackstageCoderSdk ( ) : BackstageCoderSdk {
185
185
const baseSdk = makeCoderSdk ( ) ;
186
186
187
187
const getWorkspaces : ( typeof baseSdk ) [ 'getWorkspaces' ] = async request => {
Original file line number Diff line number Diff line change @@ -42,14 +42,10 @@ const PROXY_URL_KEY_FOR_DISCOVERY_API = 'proxy';
42
42
43
43
type UrlPrefixes = Readonly < {
44
44
proxyPrefix : string ;
45
- apiRoutePrefix : string ;
46
- assetsRoutePrefix : string ;
47
45
} > ;
48
46
49
47
export const defaultUrlPrefixes = {
50
48
proxyPrefix : `/api/proxy` ,
51
- apiRoutePrefix : '' , // Left as empty string because code assumes that CoderSdk will add /api/v2
52
- assetsRoutePrefix : '' , // Deliberately left as empty string
53
49
} as const satisfies UrlPrefixes ;
54
50
55
51
export type UrlSyncSnapshot = Readonly < {
@@ -104,12 +100,10 @@ export class UrlSync implements UrlSyncApi {
104
100
}
105
101
106
102
private prepareNewSnapshot ( newProxyUrl : string ) : UrlSyncSnapshot {
107
- const { assetsRoutePrefix, apiRoutePrefix } = this . urlPrefixes ;
108
-
109
103
return {
110
104
baseUrl : newProxyUrl . replace ( proxyRouteReplacer , '' ) ,
111
- assetsRoute : `${ newProxyUrl } ${ CODER_PROXY_PREFIX } ${ assetsRoutePrefix } ` ,
112
- apiRoute : `${ newProxyUrl } ${ CODER_PROXY_PREFIX } ${ apiRoutePrefix } ` ,
105
+ assetsRoute : `${ newProxyUrl } ${ CODER_PROXY_PREFIX } ` ,
106
+ apiRoute : `${ newProxyUrl } ${ CODER_PROXY_PREFIX } ` ,
113
107
} ;
114
108
}
115
109
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ export const mockBackstageUrlRoot = 'http://localhost:7007';
75
75
* the final result is.
76
76
*/
77
77
export const mockBackstageApiEndpointWithoutSdkPath =
78
- `${ mockBackstageUrlRoot } ${ defaultUrlPrefixes . proxyPrefix } ${ CODER_PROXY_PREFIX } ${ defaultUrlPrefixes . apiRoutePrefix } ` as const ;
78
+ `${ mockBackstageUrlRoot } ${ defaultUrlPrefixes . proxyPrefix } ${ CODER_PROXY_PREFIX } ` as const ;
79
79
80
80
/**
81
81
* The API endpoint to use with the mock server during testing. Adds additional
@@ -94,7 +94,7 @@ export const mockBackstageApiEndpoint =
94
94
* the final result is.
95
95
*/
96
96
export const mockBackstageAssetsEndpoint =
97
- `${ mockBackstageUrlRoot } ${ defaultUrlPrefixes . proxyPrefix } ${ CODER_PROXY_PREFIX } ${ defaultUrlPrefixes . assetsRoutePrefix } ` as const ;
97
+ `${ mockBackstageUrlRoot } ${ defaultUrlPrefixes . proxyPrefix } ${ CODER_PROXY_PREFIX } ` as const ;
98
98
99
99
export const mockBearerToken = 'This-is-an-opaque-value-by-design' ;
100
100
export const mockCoderAuthToken = 'ZG0HRy2gGN-mXljc1s5FqtE8WUJ4sUc5X' ;
You can’t perform that action at this time.
0 commit comments