blob: 48fbff4e4c86fc21e414691188b9bf1988402d61 (
plain)
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
30
31
32
33
|
package config
import (
"encoding/json"
"io/ioutil"
"os"
)
type config struct {
Hostnames []string `json:"hosts"`
Port int `json:"port"`
AllowLocalPath bool `json:"allow-local-path"`
Auth bool `json:"auth"`
RootPath string `json:"root-path"`
}
var Config config
func ReadConfig() error {
file, err := os.Open("config.json")
if err != nil {
return err
} else {
defer file.Close()
}
content, _ := ioutil.ReadAll(file)
json.Unmarshal(content, &Config)
return nil
}
|