Skip to content

Commit

Permalink
Removed unnecessary url config
Browse files Browse the repository at this point in the history
  • Loading branch information
malinthaprasan committed Apr 2, 2020
1 parent a9c91df commit 20b2438
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
2 changes: 0 additions & 2 deletions import-export-cli/box/resources/init/api_params.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ environments:{{- range $name, $elem := . }}
- name: {{ $name }}
endpoints:
production:
url:
sandbox:
url:
{{- end }}
16 changes: 0 additions & 16 deletions import-export-cli/specs/params/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,9 @@ func loadApiParams(r io.Reader) (*ApiParams, error) {
return nil, err
}

// Cleanup empty URLs
cleanEmptyEnvironmentURLs(apiParams.Environments)
return apiParams, nil
}

// Remove whole production/sandbox endpoint sections of each environment when corresponding urls are empty
func cleanEmptyEnvironmentURLs (envs []Environment) {
for _, env := range envs {
if env.Endpoints != nil {
if env.Endpoints.Production != nil && env.Endpoints.Production.Url == nil {
env.Endpoints.Production = nil
}
if env.Endpoints.Sandbox != nil && env.Endpoints.Sandbox.Url == nil {
env.Endpoints.Sandbox = nil
}
}
}
}

// LoadApiParamsFromFile loads a configuration YAML file located in path. It returns an error or a valid ApiParams
func LoadApiParamsFromFile(path string) (*ApiParams, error) {
r, err := os.Open(path)
Expand Down

0 comments on commit 20b2438

Please sign in to comment.