From 0a5f8f0aeab927faf0430b63bc13304eeb1d78e1 Mon Sep 17 00:00:00 2001 From: hhftechnologies Date: Mon, 29 Sep 2025 23:57:35 +0530 Subject: [PATCH 1/3] Update main.yml --- .github/workflows/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 497211d2c..1b844d20e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,9 +3,7 @@ name: Build and Push Docker Image on: push: branches: - - main - - master - - dev + - traefik-int paths: - 'Dockerfile' - 'go.mod' From b04321fa4e50ab8226ea4a549fd46fecc240e21e Mon Sep 17 00:00:00 2001 From: hhftechnologies Date: Tue, 30 Sep 2025 00:01:18 +0530 Subject: [PATCH 2/3] Update config_generator.go --- services/config_generator.go | 46 ++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/services/config_generator.go b/services/config_generator.go index d05d3c5a1..485e3309f 100644 --- a/services/config_generator.go +++ b/services/config_generator.go @@ -304,6 +304,7 @@ func extractBaseName(id string) string { return id } +// processResourcesWithServices processes resources with their assigned services // processResourcesWithServices processes resources with their assigned services func (cg *ConfigGenerator) processResourcesWithServices(config *TraefikConfig) error { activeDSConfig, err := cg.configManager.GetActiveDataSourceConfig() @@ -445,27 +446,22 @@ func (cg *ConfigGenerator) processResourcesWithServices(config *TraefikConfig) e } } -// Find the section where serviceReference is set -var serviceReference string -if mapValueDataEntry.CustomServiceID.Valid && mapValueDataEntry.CustomServiceID.String != "" { - // Extract base name without any suffixes - baseName := normalizeServiceID(mapValueDataEntry.CustomServiceID.String) - // Always add the file provider for custom services - serviceReference = fmt.Sprintf("%s@file", baseName) -} else { - // For Docker environments when using Traefik API, prefer docker provider - providerSuffix := "docker" - - // If not using Traefik API as data source, use http provider - if activeDSConfig.Type != models.TraefikAPI { - providerSuffix = "http" - } - - // Extract base name without any suffixes - baseName := normalizeServiceID(info.ServiceID) - // Add the appropriate provider suffix - serviceReference = fmt.Sprintf("%s@%s", baseName, providerSuffix) -} + var serviceReference string + if mapValueDataEntry.CustomServiceID.Valid && mapValueDataEntry.CustomServiceID.String != "" { + baseName := normalizeServiceID(mapValueDataEntry.CustomServiceID.String) + serviceReference = fmt.Sprintf("%s@file", baseName) + } else { + if strings.Contains(info.ServiceID, "@") { + serviceReference = info.ServiceID + } else { + providerSuffix := "docker" + if activeDSConfig.Type != models.TraefikAPI { + providerSuffix = "http" + } + baseName := normalizeServiceID(info.ServiceID) + serviceReference = fmt.Sprintf("%s@%s", baseName, providerSuffix) + } + } log.Printf("Resource %s (HTTP): Router service set to %s. (SourceType: %s, ActiveDS: %s, CustomSvc: %s)", info.ID, @@ -474,9 +470,13 @@ if mapValueDataEntry.CustomServiceID.Valid && mapValueDataEntry.CustomServiceID. activeDSConfig.Type, mapValueDataEntry.CustomServiceID.String) - // Make sure we don't have duplicated suffixes in router ID routerIDBase := extractBaseName(info.ID) - routerIDForTraefik := fmt.Sprintf("%s-auth", routerIDBase) + var routerIDForTraefik string + if strings.HasSuffix(routerIDBase, "-auth") { + routerIDForTraefik = routerIDBase + } else { + routerIDForTraefik = fmt.Sprintf("%s-auth", routerIDBase) + } routerConfig := map[string]interface{}{ "rule": fmt.Sprintf("Host(`%s`)", info.Host), From 37a0c5e8ad90bd5e0c368ae7693d93f5f56d849f Mon Sep 17 00:00:00 2001 From: HHF Technology Date: Tue, 30 Sep 2025 09:12:43 +0530 Subject: [PATCH 3/3] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1b844d20e..ded781846 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: Build and Push Docker Image on: push: branches: - - traefik-int + - dev paths: - 'Dockerfile' - 'go.mod'