From ec2b5d973648e7dd4d45d058d00462c61118fa23 Mon Sep 17 00:00:00 2001 From: Ritek <140505097+ritek01@users.noreply.github.com> Date: Wed, 19 Jun 2024 23:39:19 +0530 Subject: [PATCH] Add Support for DevSpace (#123) --- helper.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/helper.go b/helper.go index abce607..25ae078 100644 --- a/helper.go +++ b/helper.go @@ -25,6 +25,7 @@ const ( Dev = "Dev" Prod3 = "Prod3" SelfManaged = "SelfManaged" + DevSpace = "DevSpace" ) const ( @@ -34,6 +35,8 @@ const ( PipelineService = "Pipeline" ) +var host = os.Getenv("HOST_NAME") + var urlMap = map[string]map[string]string{ Prod: { PipelineService: "https://app.harness.io/gateway/pipeline", @@ -59,6 +62,12 @@ var urlMap = map[string]map[string]string{ MigratorService: "https://app3.harness.io/gateway/ng-migration/api/ng-migration", NextGenService: "https://app3.harness.io/gateway/ng", }, + DevSpace: { + PipelineService: "https://" + host + ".pr2.harness.io/gateway/pipeline", + TemplateService: "https://" + host + ".pr2.harness.io/gateway/template", + MigratorService: "https://" + host + ".pr2.harness.io/gateway/ng-migration/api/ng-migration", + NextGenService: "https://" + host + ".pr2.harness.io/gateway/ng", + }, } func TextInput(question string) string { @@ -327,6 +336,9 @@ func GetBaseUrl(environment string, service string) string { environment = "Prod" } if environment != SelfManaged { + if len(host) == 0 && environment == DevSpace { + log.Fatal("HOST_NAME env variable is not set for DevSpace Environment") + } url := urlMap[environment][service] if len(url) == 0 { log.Fatalf("invalid environment value - %s", environment)