1
1
import type { RemotesConfig } from '../../config' ;
2
2
import { SelfHostedIntegrationId } from '../../constants.integrations' ;
3
3
import type { Container } from '../../container' ;
4
- import type { CloudIntegrationConnection } from '../../plus/integrations/authentication/models' ;
5
- import { toIntegrationId } from '../../plus/integrations/authentication/models' ;
4
+ import type { ConfiguredProviderAuthenticationDescriptor } from '../../plus/integrations/authentication/models' ;
6
5
import { Logger } from '../../system/logger' ;
7
6
import { configuration } from '../../system/vscode/configuration' ;
8
7
import { AzureDevOpsRemote } from './azure-devops' ;
@@ -78,7 +77,7 @@ const builtInProviders: RemoteProviders = [
78
77
79
78
export function loadRemoteProviders (
80
79
cfg : RemotesConfig [ ] | null | undefined ,
81
- connectedIntegrations : CloudIntegrationConnection [ ] | undefined ,
80
+ configuredIntegrations ?: ConfiguredProviderAuthenticationDescriptor [ ] ,
82
81
) : RemoteProviders {
83
82
const providers : RemoteProviders = [ ] ;
84
83
@@ -103,10 +102,10 @@ export function loadRemoteProviders(
103
102
}
104
103
}
105
104
106
- if ( connectedIntegrations ?. length ) {
107
- for ( const ci of connectedIntegrations ) {
108
- if ( toIntegrationId [ ci . provider ] === SelfHostedIntegrationId . CloudGitHubEnterprise ) {
109
- const matcher = new URL ( ci . domain ) . host . toLocaleLowerCase ( ) ;
105
+ if ( configuredIntegrations ?. length ) {
106
+ for ( const ci of configuredIntegrations ) {
107
+ if ( ci . integrationId === SelfHostedIntegrationId . CloudGitHubEnterprise && ci . domain ) {
108
+ const matcher = ci . domain . toLocaleLowerCase ( ) ;
110
109
const providerCreator = ( _container : Container , domain : string , path : string ) =>
111
110
new GitHubRemote ( domain , path ) ;
112
111
const provider = {
@@ -165,14 +164,15 @@ function getCustomProviderCreator(cfg: RemotesConfig) {
165
164
}
166
165
}
167
166
168
- export async function getRemoteProviderMatcher (
167
+ export function getRemoteProviderMatcher (
169
168
container : Container ,
170
169
providers ?: RemoteProviders ,
171
- ) : Promise < ( url : string , domain : string , path : string ) => RemoteProvider | undefined > {
170
+ ) : ( url : string , domain : string , path : string ) => RemoteProvider | undefined {
172
171
if ( providers == null ) {
173
- const ci = await container . cloudIntegrations ;
174
- const c = await ci ?. getConnections ( ) ;
175
- providers = loadRemoteProviders ( configuration . get ( 'remotes' , null ) , c ) ;
172
+ providers = loadRemoteProviders (
173
+ configuration . get ( 'remotes' , null ) ,
174
+ container . integrations . getConfiguredIntegrationDescriptors ( ) ,
175
+ ) ;
176
176
}
177
177
178
178
return ( url : string , domain : string , path : string ) =>
0 commit comments