Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: consider overriden url on cli formatting #3356

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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