Documentation ¶
Index ¶
- Constants
- Variables
- func LoadConfig[T any](root RootConfig, dst *T, secretsMgr SecretsManager)
- type CORS
- type Config
- type DataDogConfig
- type DatabaseConfig
- type EnvConfig
- type EnvType
- type Host
- type HttpServerConfig
- type JWTConfig
- type LogConfig
- type LogConfigWriter
- type LogLevel
- type PanicSecretsManager
- type RedisConfig
- type RootConfig
- type SecretsConfig
- type SecretsManager
- type SlackConfig
- type TLSConfig
Constants ¶
View Source
const ( LogLevelTrace = LogLevel(slog.LevelDebug - 4) // TRACE LogLevelDebug = LogLevel(slog.LevelDebug) // DEBUG LogLevelInfo = LogLevel(slog.LevelInfo) // INFO LogLevelWarn = LogLevel(slog.LevelWarn) // WARN LogLevelError = LogLevel(slog.LevelError) // ERROR )
Variables ¶
View Source
var Module = fx.Options( fx.Provide(fx.Annotate(NewConfig, fx.ParamTags("", `optional:"true"`))), fx.Provide(GetRootConfig), )
Module exports dependency
View Source
var TraceAsSlogStr = slog.Level(LogLevelTrace).String()
TraceAsSlogStr is the string representation of the TRACE log level within the slog package: "DEBUG-4"
Functions ¶
func LoadConfig ¶
func LoadConfig[T any](root RootConfig, dst *T, secretsMgr SecretsManager)
Types ¶
type CORS ¶
func (CORS) MarshalJSON ¶
type Config ¶
type Config struct { RootConfig Database DatabaseConfig Redis RedisConfig HttpServer HttpServerConfig JWT JWTConfig Slack SlackConfig }
func NewConfig ¶
func NewConfig(root RootConfig, secretsMgr SecretsManager) Config
type DataDogConfig ¶
type EnvType ¶
type EnvType string
const EnvTypeLocal EnvType = "local"
const EnvTypeProd EnvType = "prod"
const EnvTypeSandbox EnvType = "sandbox"
const EnvTypeTest EnvType = "test"
type HttpServerConfig ¶
type LogConfig ¶
type LogConfig struct { Level LogLevel Levels map[string]LogLevel Writer LogConfigWriter }
type LogConfigWriter ¶
type LogConfigWriter string
const ( LogConfigWriterStdout LogConfigWriter = "stdout" LogConfigWriterStderr LogConfigWriter = "stderr" LogConfigWriterBuffer LogConfigWriter = "buffer" )
func (LogConfigWriter) MarshalText ¶
func (w LogConfigWriter) MarshalText() ([]byte, error)
MarshalText returns the string representation of a logger writer
func (*LogConfigWriter) UnmarshalText ¶
func (w *LogConfigWriter) UnmarshalText(text []byte) error
UnmarshalText parses a logger writer from a string
type LogLevel ¶
func (LogLevel) MarshalText ¶
MarshalText returns the string representation of a log level
func (*LogLevel) UnmarshalText ¶
UnmarshalText parses a log level from a string
type PanicSecretsManager ¶
type PanicSecretsManager struct { }
func (PanicSecretsManager) GetSecretVerbatim ¶
type RedisConfig ¶
type RedisConfig struct {
URL string
}
type RootConfig ¶
type RootConfig struct { Name string Secrets SecretsConfig Env EnvConfig Log LogConfig Datadog DataDogConfig }
func GetRootConfig ¶ added in v0.5.0
func GetRootConfig() RootConfig
type SecretsConfig ¶
type SecretsManager ¶
type SecretsManager interface { GetSecret(ctx context.Context, key string) (string, error) GetSecretVerbatim(ctx context.Context, id string) (string, error) }
SecretsManager is a minimal interface needed to process config secrets
type SlackConfig ¶
Click to show internal directories.
Click to hide internal directories.