34 lines
556 B
Go
34 lines
556 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
|
|
gocnjhelper "git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper"
|
|
"gopkg.in/yaml.v2"
|
|
)
|
|
|
|
var Cfg Config
|
|
|
|
type Config struct {
|
|
Debug bool
|
|
RabbitMq RabbitMq
|
|
}
|
|
|
|
type RabbitMq struct {
|
|
Host string
|
|
Username string
|
|
Password string
|
|
}
|
|
|
|
func LoadConfig() {
|
|
data, err := os.ReadFile("config.yml")
|
|
|
|
if err != nil {
|
|
gocnjhelper.LogFatalf("Failed to read config file, err: %s", err)
|
|
}
|
|
|
|
if err := yaml.Unmarshal(data, &Cfg); err != nil {
|
|
gocnjhelper.LogFatalf("Failed to unmarshal config file, err: %s", err)
|
|
}
|
|
}
|