MCPcopy Index your code
hub / github.com/cortexlabs/cortex / getEnvNamesByOperatorEndpoint

Function getEnvNamesByOperatorEndpoint

cli/cmd/lib_cli_config.go:574–593  ·  view source on GitHub ↗

returns the list of environment names, and whether any of them were the default

(operatorEndpoint string)

Source from the content-addressed store, hash-verified

572
573// returns the list of environment names, and whether any of them were the default
574func getEnvNamesByOperatorEndpoint(operatorEndpoint string) ([]string, bool, error) {
575 cliConfig, err := readCLIConfig()
576 if err != nil {
577 return nil, false, err
578 }
579
580 var envNames []string
581 isDefaultEnv := false
582
583 for _, env := range cliConfig.Environments {
584 if env.OperatorEndpoint != "" && s.LastSplit(env.OperatorEndpoint, "//") == s.LastSplit(operatorEndpoint, "//") {
585 envNames = append(envNames, env.Name)
586 if cliConfig.DefaultEnvironment != nil && env.Name == *cliConfig.DefaultEnvironment {
587 isDefaultEnv = true
588 }
589 }
590 }
591
592 return envNames, isDefaultEnv, nil
593}
594
595func readCLIConfig() (cliconfig.CLIConfig, error) {
596 if !files.IsFile(_cliConfigPath) {

Callers 1

cluster.goFile · 0.85

Calls 1

readCLIConfigFunction · 0.85

Tested by

no test coverage detected