package config import ( "io/ioutil" "log" "gopkg.in/yaml.v2" ) var Cfg Config type Config struct { Bot Bot } type Bot struct { HomeserverUrl string `yaml:"homeserver_url"` User string Password string RoomId string `yaml:"room_id"` } func LoadConfig() { file, err := ioutil.ReadFile("../school-portal-substitution-plan-matrix-chat-bot/config.yaml") if err != nil { log.Fatalln("failed to load yaml file", err) } err = yaml.Unmarshal(file, &Cfg) if err != nil { log.Fatalln("failed to unmarshal config", err) } }