From b4880c254f590cdf61dc5111a7854206cc58db98 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Wed, 11 Feb 2015 02:19:24 +0700 Subject: [PATCH] Ok, now we need config --- .gitignore | 1 + core/config.go | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 .gitignore create mode 100644 core/config.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d344ba6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config.json diff --git a/core/config.go b/core/config.go new file mode 100644 index 0000000..573111a --- /dev/null +++ b/core/config.go @@ -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 +}