summaryrefslogtreecommitdiffstats
path: root/config.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2015-10-23 22:34:37 +0200
committerWim <wim@42.be>2015-10-23 22:34:37 +0200
commitcbd01d4a552f05f36ef3d8b259c4305cd3ce06c8 (patch)
treeb7088d7478c7e767113e4014aceba872475b7e1b /config.go
parent74d0d3fd5ba5e9b7e9ef90e5c2621fb28f4a8a53 (diff)
downloadmatterbridge-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.go35
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
+}