reflector.go/main.go

34 lines
471 B
Go
Raw Normal View History

package main
import (
2018-01-29 20:37:26 +01:00
"encoding/json"
"io/ioutil"
2018-02-02 22:48:57 +01:00
"github.com/lbryio/reflector.go/cmd"
2018-01-29 20:37:26 +01:00
log "github.com/sirupsen/logrus"
)
func checkErr(err error) {
if err != nil {
panic(err)
}
}
func main() {
log.SetLevel(log.DebugLevel)
2018-02-02 22:48:57 +01:00
cmd.GlobalConfig = loadConfig("config.json")
cmd.Execute()
2018-01-29 20:37:26 +01:00
}
2018-02-02 22:48:57 +01:00
func loadConfig(path string) cmd.Config {
2018-01-29 20:37:26 +01:00
raw, err := ioutil.ReadFile(path)
checkErr(err)
2018-01-29 20:37:26 +01:00
2018-02-02 22:48:57 +01:00
var c cmd.Config
2018-01-29 20:37:26 +01:00
err = json.Unmarshal(raw, &c)
checkErr(err)
2018-01-29 20:37:26 +01:00
return c
}