eafb45f60709eb9b492d0a3e47a008df1197a142

Author
Ayman Bagabas <ayman.bagabas@gmail.com>
Committer
Ayman Bagabas <ayman.bagabas@gmail.com>
Date

Message

feat(cfg): debug logging environment variable

Diff

 1diff --git a/server/config/config.go b/server/config/config.go
 2index 2250de3d98476cc82e8e5d6e815b39a2442b0d9f..79cc867f4c2c3fdfbe18f81dff9a5c544f8b44fe 100644
 3--- a/server/config/config.go
 4+++ b/server/config/config.go
 5@@ -22,6 +22,7 @@ type Config struct {
 6 	Port             int      `env:"SOFT_SERVE_PORT" envDefault:"23231"`
 7 	KeyPath          string   `env:"SOFT_SERVE_KEY_PATH"`
 8 	RepoPath         string   `env:"SOFT_SERVE_REPO_PATH" envDefault:".repos"`
 9+	Debug            bool     `env:"SOFT_SERVE_DEBUG" envDefault:"false"`
10 	InitialAdminKeys []string `env:"SOFT_SERVE_INITIAL_ADMIN_KEY" envSeparator:"\n"`
11 	Callbacks        Callbacks
12 	ErrorLog         *glog.Logger
13@@ -34,6 +35,9 @@ func DefaultConfig() *Config {
14 	if err := env.Parse(cfg); err != nil {
15 		log.Fatal(err)
16 	}
17+	if cfg.Debug {
18+		log.SetLevel(log.DebugLevel)
19+	}
20 	if cfg.KeyPath == "" {
21 		// NB: cross-platform-compatible path
22 		cfg.KeyPath = filepath.Join(".ssh", "soft_serve_server_ed25519")