From eafb45f60709eb9b492d0a3e47a008df1197a142 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Tue, 21 Feb 2023 12:27:46 -0500 Subject: [PATCH] feat(cfg): debug logging environment variable --- server/config/config.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/config/config.go b/server/config/config.go index 2250de3d9..79cc867f4 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -22,6 +22,7 @@ type Config struct { Port int `env:"SOFT_SERVE_PORT" envDefault:"23231"` KeyPath string `env:"SOFT_SERVE_KEY_PATH"` RepoPath string `env:"SOFT_SERVE_REPO_PATH" envDefault:".repos"` + Debug bool `env:"SOFT_SERVE_DEBUG" envDefault:"false"` InitialAdminKeys []string `env:"SOFT_SERVE_INITIAL_ADMIN_KEY" envSeparator:"\n"` Callbacks Callbacks ErrorLog *glog.Logger @@ -34,6 +35,9 @@ func DefaultConfig() *Config { if err := env.Parse(cfg); err != nil { log.Fatal(err) } + if cfg.Debug { + log.SetLevel(log.DebugLevel) + } if cfg.KeyPath == "" { // NB: cross-platform-compatible path cfg.KeyPath = filepath.Join(".ssh", "soft_serve_server_ed25519")