isl-api/envConfigs.go

28 lines
578 B
Go

package main
import (
"log/slog"
"strings"
)
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
}
}