group_helper/config/database.go

21 lines
499 B
Go
Raw Normal View History

package config
import "github.com/caarlos0/env"
type DatabaseConfig struct {
Debug bool `env:"DB_DEBUG" envDefault:"false"`
DatabaseType string `env:"DB_TYPE,required"`
Host string `env:"DB_HOST,required"`
Port int `env:"DB_PORT"`
Username string `env:"DB_USER"`
Password string `env:"DB_PASS"`
Database string `env:"DB_DATABASE"`
}
func (dc *DatabaseConfig) LoadConfig() error {
if err := env.Parse(dc); err != nil {
return err
}
return nil
}