Skip to content

Commit

Permalink
only use pretty logging when running locally
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmichels committed Jun 13, 2023
1 parent 5456dd8 commit 3b7ed6a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ COPY --from=builder /usr/bin/course-sense-go /usr/bin/course-sense-go

RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
ENV app_env=prod

ENTRYPOINT [ "/usr/bin/course-sense-go" ]
6 changes: 5 additions & 1 deletion cmd/coursesense/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ import (
)

func main() {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stdout})
// use pretty logging for local development
// app_env is set in the dockerfile
if os.Getenv("app_env") != "prod" {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stdout})
}

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down

0 comments on commit 3b7ed6a

Please sign in to comment.