23 lines
496 B
Go
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
|
|
}
|