ms-tester/internal/lib/config.go
Vyacheslav1557 3c0f01630f refactor:
2024-08-16 16:05:29 +05:00

23 lines
496 B
Go

package lib
import (
"fmt"
"github.com/ilyakaznacheev/cleanenv"
)
type Config struct {
Env string `env:"ENV" env-default:"prod"`
Pandoc string `env:"PANDOC" required:"true"`
PostgresDSN string `env:"POSTGRES_DSN" required:"true"`
JWTSecret string `env:"JWT_SECRET" required:"true"`
}
func MustSetupConfig() *Config {
var cfg Config
err := cleanenv.ReadConfig(".env", &cfg)
if err != nil {
panic(fmt.Sprintf("error reading config: %s", err.Error()))
}
return &cfg
}