Skip to content

Commit

Permalink
feat(cfg): debug logging environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Feb 21, 2023
1 parent d644400 commit eafb45f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down

0 comments on commit eafb45f

Please sign in to comment.