[go: nahoru, domu]

Skip to content

Commit

Permalink
cli, docker: add env variable to set loglevel
Browse files Browse the repository at this point in the history
  • Loading branch information
gessecarneiro authored and otavio committed Sep 19, 2022
1 parent d1ea4c7 commit c924e5a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/kelseyhightower/envconfig"
storecache "github.com/shellhub-io/shellhub/api/cache"
"github.com/shellhub-io/shellhub/api/store/mongo"
"github.com/shellhub-io/shellhub/pkg/loglevel"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
mgo "go.mongodb.org/mongo-driver/mongo"
Expand All @@ -18,6 +19,10 @@ type config struct {
RedisURI string `envconfig:"redis_uri" default:"redis://redis:6379"`
}

func init() {
loglevel.SetLogLevel()
}

func main() {
var cfg config
if err := envconfig.Process("cli", &cfg); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ services:
- SHELLHUB_CLOUD=${SHELLHUB_CLOUD}
- SHELLHUB_BILLING=${SHELLHUB_BILLING}
- SHELLHUB_ENV=${SHELLHUB_ENV}
- SHELLHUB_LOG_LEVEL=${SHELLHUB_LOG_LEVEL}
api:
image: api
build:
Expand All @@ -38,7 +37,6 @@ services:
- SHELLHUB_ENTERPRISE=${SHELLHUB_ENTERPRISE}
- SHELLHUB_CLOUD=${SHELLHUB_CLOUD}
- SHELLHUB_ENV=${SHELLHUB_ENV}
- SHELLHUB_LOG_LEVEL=${SHELLHUB_LOG_LEVEL}
ui:
image: ui
build:
Expand Down Expand Up @@ -71,7 +69,7 @@ services:
args:
- SHELLHUB_VERSION=latest
- GOPROXY=${SHELLHUB_GOPROXY}

- SHELLHUB_LOG_LEVEL=${SHELLHUB_LOG_LEVEL}
privileged: true
network_mode: host
pid: host
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ services:
image: shellhubio/cli:${SHELLHUB_VERSION}
entrypoint: /bin/sleep infinity
restart: unless-stopped
environment:
- SHELLHUB_LOG_LEVEL=${SHELLHUB_LOG_LEVEL}
depends_on:
- api
- mongo
Expand Down

0 comments on commit c924e5a

Please sign in to comment.