Skip to content

Commit

Permalink
fix: consider overriden url on cli formatting (#3356)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbdias authored Nov 14, 2023
1 parent 4d13812 commit a27be36
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions cli/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func overrideConfig() {
}
cliConfig.Scheme = scheme
cliConfig.Endpoint = endpoint
cliConfig.EndpointOverriden = true
}
}

Expand Down
19 changes: 10 additions & 9 deletions cli/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ type ConfigFlags struct {
}

type Config struct {
Scheme string `yaml:"scheme"`
Endpoint string `yaml:"endpoint"`
ServerPath *string `yaml:"serverPath,omitempty"`
OrganizationID string `yaml:"organizationID,omitempty"`
EnvironmentID string `yaml:"environmentID,omitempty"`
Token string `yaml:"token,omitempty"`
Jwt string `yaml:"jwt,omitempty"`
AgentApiKey string `yaml:"-"`
Scheme string `yaml:"scheme"`
Endpoint string `yaml:"endpoint"`
ServerPath *string `yaml:"serverPath,omitempty"`
OrganizationID string `yaml:"organizationID,omitempty"`
EnvironmentID string `yaml:"environmentID,omitempty"`
Token string `yaml:"token,omitempty"`
Jwt string `yaml:"jwt,omitempty"`
AgentApiKey string `yaml:"-"`
EndpointOverriden bool `yaml:"-"`

// cloud config
CloudAPIEndpoint string `yaml:"-"`
Expand All @@ -55,7 +56,7 @@ func (c Config) URL() string {
}

func (c Config) UI() string {
if c.UIEndpoint != "" {
if c.UIEndpoint != "" && !c.EndpointOverriden {
return fmt.Sprintf("%s/organizations/%s/environments/%s", strings.TrimSuffix(c.UIEndpoint, "/"), c.OrganizationID, c.EnvironmentID)
}

Expand Down

0 comments on commit a27be36

Please sign in to comment.