1
0
Fork 0
This commit is contained in:
Gregory Eremin 2015-02-11 02:41:15 +07:00
parent 1b9721825d
commit a845d56b54
2 changed files with 39 additions and 0 deletions

23
app.go Normal file
View File

@ -0,0 +1,23 @@
package main
import (
"flag"
"github.com/kr/pretty"
"github.com/localhots/confection"
"github.com/localhots/yeast/core"
)
func init() {
confection.SetupFlags()
flag.Parse()
}
func main() {
core.InitConfig()
core.LoadUnits()
core.ParseChains()
pretty.Println(core.Conf())
select {}
}

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 {