Skip to content

Commit

Permalink
backport: return an error if cscli dashboard is run within a container (
Browse files Browse the repository at this point in the history
#3208)

* enhance: return an error if cscli dashboard is run within a container

* move docker check on top

---------

Co-authored-by: marco <marco@crowdsec.net>
  • Loading branch information
LaurenceJJones and mmetc authored Sep 2, 2024
1 parent 7c2ebe5 commit a987dfc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/crowdsec-cli/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

"github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/require"
"github.com/crowdsecurity/crowdsec/pkg/metabase"
"github.com/crowdsecurity/go-cs-lib/version"
)

var (
Expand Down Expand Up @@ -69,6 +70,10 @@ cscli dashboard stop
cscli dashboard remove
`,
PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
if version.System == "docker" {
return errors.New("cscli dashboard is not supported whilst running CrowdSec within a container please see: https://github.com/crowdsecurity/example-docker-compose/tree/main/basic")
}

cfg := cli.cfg()
if err := require.LAPI(cfg); err != nil {
return err
Expand Down

0 comments on commit a987dfc

Please sign in to comment.