This commit is contained in:
2015-02-11 02:41:15 +07:00
parent 1b9721825d
commit a845d56b54
2 changed files with 39 additions and 0 deletions
+16
View File
@@ -2,6 +2,8 @@ package core
import (
"encoding/json"
"github.com/localhots/confection"
)
type (
@@ -16,6 +18,20 @@ type (
}
)
var (
conf *confection.Manager
)
func Conf() Config {
return conf.Config().(Config)
}
func InitConfig() {
conf = confection.New(Config{}, ConfigDecoder)
go conf.StartServer()
conf.RequireConfig()
}
func ConfigDecoder(b []byte) interface{} {
var newConf Config
if err := json.Unmarshal(b, &newConf); err != nil {