Skip to content

Commit

Permalink
add debug flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Huskydog9988 committed Feb 1, 2023
1 parent 849dc14 commit cfd44e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ func init() {

// // Only log the warning severity or above.
// log.SetLevel(log.WarnLevel)

if utils.Config.Debug {
log.SetLevel(log.DebugLevel)
}
}

func main() {
Expand Down
4 changes: 4 additions & 0 deletions utils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ type ConfigOptions struct {

// when appenv != production
TestGuildId string `mapstructure:"TEST_GUILD_ID"`

// debug flag
Debug bool `mapstructure:"DEBUG"`
}

// LoadConfig reads configuration from file or environment variables.
func LoadConfig(path string) (config ConfigOptions) {
// define defaults
viper.SetDefault("SENTRY_DSN", "")
viper.SetDefault("DEBUG", false)

// Read file path
viper.AddConfigPath(path)
Expand Down

0 comments on commit cfd44e6

Please sign in to comment.