From d7b611aa058962ed5dee0213a99a45f0207cefda Mon Sep 17 00:00:00 2001 From: Raido Oras Date: Tue, 8 Aug 2023 05:13:52 +0300 Subject: Allow port in webDomain for services config values --- pkg/commands/hosting_service/hosting_service.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'pkg/commands/hosting_service/hosting_service.go') diff --git a/pkg/commands/hosting_service/hosting_service.go b/pkg/commands/hosting_service/hosting_service.go index e6f9bef79..5744680ab 100644 --- a/pkg/commands/hosting_service/hosting_service.go +++ b/pkg/commands/hosting_service/hosting_service.go @@ -101,15 +101,14 @@ func (self *HostingServiceMgr) getCandidateServiceDomains() []ServiceDomain { if len(self.configServiceDomains) > 0 { for gitDomain, typeAndDomain := range self.configServiceDomains { - splitData := strings.Split(typeAndDomain, ":") - if len(splitData) != 2 { + provider, webDomain, success := strings.Cut(typeAndDomain, ":") + + // we allow for one ':' for specifying the TCP port + if !success || strings.Count(webDomain, ":") > 1 { self.log.Errorf("Unexpected format for git service: '%s'. Expected something like 'github.com:github.com'", typeAndDomain) continue } - provider := splitData[0] - webDomain := splitData[1] - serviceDefinition, ok := serviceDefinitionByProvider[provider] if !ok { providerNames := lo.Map(serviceDefinitions, func(serviceDefinition ServiceDefinition, _ int) string { -- cgit v1.2.3