isl-api/envConfigs.go

29 lines
578 B
Go
Raw Normal View History

2024-01-31 14:51:42 -05:00
package main
import (
"log/slog"
"strings"
)
2024-01-31 14:51:42 -05:00
type EnvConfigs struct {
HttpPort string `mapstructure:"HTTP_PORT"`
ConnectionString string `mapstructure:"DB_CONNECTION_STRING"`
JWKSURI string `mapstructure:"JWKS_URI"`
LogLevel string `mapstructure:"LOG_LEVEL"`
}
func (ec *EnvConfigs) GetLogLevel() slog.Level {
switch strings.ToLower(ec.LogLevel) {
case "debug":
return slog.LevelDebug
case "info":
return slog.LevelInfo
case "warn":
return slog.LevelWarn
case "error":
return slog.LevelError
default:
return slog.LevelInfo
}
2024-01-31 14:51:42 -05:00
}