aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/config.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/config/config.go b/config/config.go
new file mode 100644
index 0000000..59baa2b
--- /dev/null
+++ b/config/config.go
@@ -0,0 +1,29 @@
+package config
+
+import (
+ "encoding/json"
+ "io/ioutil"
+ "log"
+)
+
+type Settings struct {
+ DBServer string
+ WebServer string
+ Username string
+ Realm string
+ DigestPassword string
+}
+
+var Config Settings
+
+func Read(filename string) {
+ file, e := ioutil.ReadFile(filename)
+ if e != nil {
+ log.Fatal("Can not read config file", e)
+ }
+
+ e = json.Unmarshal(file, &Config)
+ if e != nil {
+ log.Fatal("Config read error", e)
+ }
+}