App #yay
This commit is contained in:
parent
1b9721825d
commit
a845d56b54
|
@ -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 {}
|
||||
}
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue