feat(cli): add environment contexts#3
Conversation
| case ContextStage: | ||
| return ContextConfig{APIBaseURL: stageAPIURL, DeviceClientID: devDeviceClientID} | ||
| case ContextProd: | ||
| return ContextConfig{APIBaseURL: prodAPIURL, DeviceClientID: prodDeviceClientID} |
There was a problem hiding this comment.
This hardcodes the prod API URL and OAuth client ID, which makes the ldflag-injected compiledDefaultAPIURL and compiledFirstPartyDeviceClientID effectively unreachable for the default prod context. The release build still injects those values through the Makefile/publish workflow, so a rotated client ID or alternate build target would not be honored after this change. Can the prod preset use the compiled values, and can DeviceClientID() still fall back to compiledFirstPartyDeviceClientID before hardcoded defaults?
| Short: "List contexts", | ||
| Args: cobra.NoArgs, | ||
| RunE: func(cmd *cobra.Command, _ []string) error { | ||
| cfg, err := config.Load() |
There was a problem hiding this comment.
This command loads config directly, so it never sees the root deps.ContextName pointer populated by the global --context flag. As a result, volcano --context stage context list still marks prod as current. Can the context command accept/apply the same override, or otherwise keep the advertised global context selection consistent here?
| ) | ||
|
|
||
| const authAlphaProjectID = "11111111-1111-4111-8111-111111111111" | ||
| const testProdDeviceClientID = "devcli_94e247237984b85cfd58d37e" |
There was a problem hiding this comment.
CI is currently failing gofumpt on this const section. Grouping the three const declarations should satisfy the formatter.
| } | ||
| name := config.NormalizeContextName(opts.name) | ||
| if name == "" { | ||
| return fmt.Errorf("context name cannot be empty") |
There was a problem hiding this comment.
CI is currently failing perfsprint here because this static error can be errors.New(...) instead of fmt.Errorf(...).
|
This is not yet ready for review. was incorrectly marked ready. |
Summary
volcano context,--context, andVOLCANO_CONTEXTTests
go test ./...