1
0
Fork 0

Ok, now we need config

This commit is contained in:
Gregory Eremin 2015-02-11 02:19:24 +07:00
parent 5f8329d368
commit b4880c254f
2 changed files with 26 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
config.json

25
core/config.go Normal file
View File

@ -0,0 +1,25 @@
package core
import (
"encoding/json"
)
type (
Config struct {
ChainsConfig string `json:"chains_config_path" attrs:"required" title:"Chains config path"`
UnitsConfig string `json:"units_config_path" attrs:"required" title:"Units config path"`
Python Python `json:"python" title:"Python"`
}
Python struct {
BinPath string `json:"bin_path" attrs:"required" title:"Python 3 binary path"`
WrapperPath string `json:"wrapper_path" attrs:"required" title:"Path to wrapper.py"`
}
)
func ConfigDecoder(b []byte) interface{} {
var newConf Config
if err := json.Unmarshal(b, &newConf); err != nil {
panic(err)
}
return newConf
}