Skip to content
This repository was archived by the owner on Jun 16, 2026. It is now read-only.

Commit ca78fe7

Browse files
committed
Switch Compose context handling to switch statement
Signed-off-by: Jacob Howard <jacob.howard@docker.com>
1 parent 0d20212 commit ca78fe7

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

commands/compose.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,17 @@ func newUpCommand() *cobra.Command {
4949
return err
5050
}
5151

52-
if kind == desktop.ModelRunnerEngineKindDesktop {
53-
// TODO: Get the actual URL from Docker Desktop via some API.
52+
switch kind {
53+
case desktop.ModelRunnerEngineKindDesktop:
5454
_ = setenv("URL", "http://model-runner.docker.internal/engines/v1/")
55-
} else if kind == desktop.ModelRunnerEngineKindMobyManual {
55+
case desktop.ModelRunnerEngineKindMobyManual:
5656
_ = setenv("URL", modelRunner.URL("/engines/v1/"))
57-
} else if kind == desktop.ModelRunnerEngineKindMoby || kind == desktop.ModelRunnerEngineKindCloud {
57+
case desktop.ModelRunnerEngineKindCloud:
58+
fallthrough
59+
case desktop.ModelRunnerEngineKindMoby:
5860
_ = setenv("URL", fmt.Sprintf("http://%s:%d/engines/v1", standalone.gatewayIP, standalone.gatewayPort))
61+
default:
62+
return fmt.Errorf("unhandled engine kind: %v", kind)
5963
}
6064
return nil
6165
},

0 commit comments

Comments
 (0)