diff options
author | Wim <wim@42.be> | 2015-10-23 22:34:37 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2015-10-23 22:34:37 +0200 |
commit | cbd01d4a552f05f36ef3d8b259c4305cd3ce06c8 (patch) | |
tree | b7088d7478c7e767113e4014aceba872475b7e1b /config.go | |
parent | 74d0d3fd5ba5e9b7e9ef90e5c2621fb28f4a8a53 (diff) | |
download | matterbridge-msglm-cbd01d4a552f05f36ef3d8b259c4305cd3ce06c8.tar.gz matterbridge-msglm-cbd01d4a552f05f36ef3d8b259c4305cd3ce06c8.tar.bz2 matterbridge-msglm-cbd01d4a552f05f36ef3d8b259c4305cd3ce06c8.zip |
Initial matterbridge commit
Diffstat (limited to 'config.go')
-rw-r--r-- | config.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/config.go b/config.go new file mode 100644 index 00000000..17d4bbd8 --- /dev/null +++ b/config.go @@ -0,0 +1,35 @@ +package main + +import ( + "gopkg.in/gcfg.v1" + "io/ioutil" + "log" +) + +type Config struct { + IRC struct { + UseTLS bool + SkipTLSVerify bool + Server string + Port int + Nick string + Channel string + } + Mattermost struct { + URL string + Port int + } +} + +func NewConfig(cfgfile string) *Config { + var cfg Config + content, err := ioutil.ReadFile(cfgfile) + if err != nil { + log.Fatal(err) + } + err = gcfg.ReadStringInto(&cfg, string(content)) + if err != nil { + log.Fatal("Failed to parse "+cfgfile+":", err) + } + return &cfg +} |