aboutsummaryrefslogtreecommitdiffstats
path: root/config/config.go
blob: fef1addc8dc9501f5e526166203b6c8194a1514c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package config

import (
	"encoding/json"
	"io/ioutil"
	"log"
)

type Settings struct {
	DBServer       string `json:"db"`
	WebServer      string `json:"web"`
	Username       string `json:"username"`
	DigestPassword string `json:"password"`
	StaticDir      string `json:"static_dir"`
	ProxyImages    bool   `json:"proxy_images"`
}

var Config Settings

func Read(filename string) {
	file, e := ioutil.ReadFile(filename)
	if e != nil {
		log.Fatal("Can not read config file\n", e)
	}
	e = json.Unmarshal(file, &Config)
	if e != nil {
		log.Fatal("Config read error\n", e)
	}
}