51 lines
914 B
Go
51 lines
914 B
Go
package config
|
|
|
|
import (
|
|
"github.com/caarlos0/env/v11"
|
|
)
|
|
|
|
var (
|
|
Config = new(config)
|
|
)
|
|
|
|
func Load() error {
|
|
// App configuration
|
|
app := new(App)
|
|
if err := env.Parse(app); err != nil {
|
|
return err
|
|
}
|
|
Config.App = app
|
|
// Bot configuration
|
|
bot := new(Bot)
|
|
if err := env.Parse(bot); err != nil {
|
|
return err
|
|
}
|
|
Config.Bot = bot
|
|
// PostgreSQL configuration
|
|
postgre := new(Postgre)
|
|
if err := env.Parse(postgre); err != nil {
|
|
return err
|
|
}
|
|
Config.Postgre = postgre
|
|
// MinIO configuration
|
|
minio := new(Minio)
|
|
if err := env.Parse(minio); err != nil {
|
|
return err
|
|
}
|
|
Config.Minio = minio
|
|
// Tokens configuration
|
|
tokens := new(Tokens)
|
|
if err := env.Parse(tokens); err != nil {
|
|
return err
|
|
}
|
|
Config.Tokens = tokens
|
|
// Integrations configuration
|
|
integrations := new(Integrations)
|
|
if err := env.Parse(integrations); err != nil {
|
|
return err
|
|
}
|
|
Config.Integrations = integrations
|
|
|
|
return nil
|
|
}
|