Skip to content

Commit

Permalink
Add Support for DevSpace (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritek01 authored Jun 19, 2024
1 parent 4bc7f42 commit ec2b5d9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const (
Dev = "Dev"
Prod3 = "Prod3"
SelfManaged = "SelfManaged"
DevSpace = "DevSpace"
)

const (
Expand All @@ -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",
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ec2b5d9

Please sign in to comment.