Rename parser to chain_parser
This commit is contained in:
parent
b4880c254f
commit
fccc4df352
|
@ -3,10 +3,21 @@ package core
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ParseChains(b []byte) (map[string]*Chain, error) {
|
func ParseChains() (map[string]*Chain, error) {
|
||||||
|
f, err := os.Open(Conf().ChainsConfig)
|
||||||
|
if err != nil {
|
||||||
|
panic("Failed to open chains config: " + Conf().ChainsConfig)
|
||||||
|
}
|
||||||
|
b, err := ioutil.ReadAll(f)
|
||||||
|
if err != nil {
|
||||||
|
panic("Failed to parse chains config: " + Conf().ChainsConfig)
|
||||||
|
}
|
||||||
|
|
||||||
var schema map[string]interface{}
|
var schema map[string]interface{}
|
||||||
if err := json.Unmarshal(b, &schema); err != nil {
|
if err := json.Unmarshal(b, &schema); err != nil {
|
||||||
return nil, err
|
return nil, err
|
Loading…
Reference in New Issue