Skip to content

Commit 0c09cc9

Browse files
committed
Use compose menu as env
Signed-off-by: Joana Hrotko <[email protected]>
1 parent f2baf4b commit 0c09cc9

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

cmd/compose/compose.go

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ const (
6565
ComposeIgnoreOrphans = "COMPOSE_IGNORE_ORPHANS"
6666
// ComposeEnvFiles defines the env files to use if --env-file isn't used
6767
ComposeEnvFiles = "COMPOSE_ENV_FILES"
68+
// ComposeMenu defines if the navigation menu should be rendered. Can be also set via --navigation-menu
69+
ComposeMenu = "COMPOSE_MENU"
6870
)
6971

7072
type Backend interface {

cmd/compose/up.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ type upOptions struct {
5656
wait bool
5757
waitTimeout int
5858
watch bool
59-
navigationBar bool
59+
navigationMenu bool
6060
}
6161

6262
func (opts upOptions) apply(project *types.Project, services []string) (*types.Project, error) {
@@ -129,7 +129,11 @@ func upCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service, ex
129129
flags.BoolVar(&up.wait, "wait", false, "Wait for services to be running|healthy. Implies detached mode.")
130130
flags.IntVar(&up.waitTimeout, "wait-timeout", 0, "Maximum duration to wait for the project to be running|healthy")
131131
flags.BoolVarP(&up.watch, "watch", "w", false, "Watch source code and rebuild/refresh containers when files are updated.")
132-
flags.BoolVar(&up.navigationBar, "navigation-menu", true, "While running in attach mode, enable shortcuts and shortcuts info bar.")
132+
composeMenu := true
133+
if os.Getenv(ComposeMenu) != "" {
134+
composeMenu = utils.StringToBool(os.Getenv(ComposeMenu))
135+
}
136+
flags.BoolVar(&up.navigationMenu, "navigation-menu", composeMenu, "While running in attach mode, enable shortcuts and shortcuts info bar.")
133137

134138
return upCmd
135139
}
@@ -264,7 +268,7 @@ func runUp(
264268
WaitTimeout: timeout,
265269
Watch: upOptions.watch,
266270
Services: services,
267-
NavigationBar: upOptions.navigationBar,
271+
NavigationBar: upOptions.navigationMenu,
268272
},
269273
})
270274
}

0 commit comments

Comments
 (0)