Files
kouiz/internal/config/config.go

26 lines
478 B
Go
Raw Normal View History

2025-06-10 21:09:58 +02:00
package config
import (
"github.com/caarlos0/env/v11"
"github.com/pkg/errors"
)
type Config struct {
Logger Logger `envPrefix:"LOGGER_"`
Auth Auth `envPrefix:"AUTH_"`
HTTP HTTP `envPrefix:"HTTP_"`
Store Store `envPrefix:"STORE_"`
2025-06-13 16:55:46 +02:00
Quiz Quiz `envPrefix:"QUIZ_"`
2025-06-10 21:09:58 +02:00
}
func Parse() (*Config, error) {
conf, err := env.ParseAsWithOptions[Config](env.Options{
Prefix: "KOUIZ_",
})
if err != nil {
return nil, errors.WithStack(err)
}
return &conf, nil
}