MCPcopy
hub / github.com/cortexlabs/cortex / configureEnv

Function configureEnv

cli/cmd/lib_cli_config.go:413–437  ·  view source on GitHub ↗

If envName is "", this will prompt for the environment name to configure

(envName string, fieldsToSkipPrompt cliconfig.Environment)

Source from the content-addressed store, hash-verified

411
412// If envName is "", this will prompt for the environment name to configure
413func configureEnv(envName string, fieldsToSkipPrompt cliconfig.Environment) (cliconfig.Environment, error) {
414 env := cliconfig.Environment{
415 Name: envName,
416 OperatorEndpoint: fieldsToSkipPrompt.OperatorEndpoint,
417 }
418
419 defaults := getEnvConfigDefaults(env.Name)
420
421 err := promptEnv(&env, defaults)
422 if err != nil {
423 return cliconfig.Environment{}, err
424 }
425
426 if err := env.Validate(); err != nil {
427 return cliconfig.Environment{}, err
428 }
429
430 if err := addEnvToCLIConfig(env, false); err != nil {
431 return cliconfig.Environment{}, err
432 }
433
434 print.BoldFirstLine(fmt.Sprintf("configured %s environment", env.Name))
435
436 return env, nil
437}
438
439func MustGetOperatorConfig(envName string) cluster.OperatorConfig {
440 clientID := clientID()

Callers 2

env.goFile · 0.85
ReadOrConfigureEnvFunction · 0.85

Calls 5

ValidateMethod · 0.95
BoldFirstLineFunction · 0.92
getEnvConfigDefaultsFunction · 0.85
promptEnvFunction · 0.85
addEnvToCLIConfigFunction · 0.85

Tested by

no test coverage detected