package main import ( "encoding/json" log "github.com/sirupsen/logrus" "io/ioutil" ) type configStaticHtml struct { Dir string StaticUrl string StripPrefix string } type configuration struct { Host string Port string Static []configStaticHtml Session struct { Guest bool Year int //how many years Month int //how many years Day int //how many years } } var configFile = "config.json" var config = configuration{} func (m *configuration) readConfig() (e error) { log.Printf("read Path config from %s", configFile) body, e := ioutil.ReadFile(configFile) if e != nil { log.Fatal("Cannot read config from " + configFile) return } e = json.Unmarshal(body, m) //TODO: check config before proceed further return }