2017-08-11 00:25:42 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2018-01-29 20:37:26 +01:00
|
|
|
"encoding/json"
|
|
|
|
"io/ioutil"
|
2018-01-24 17:45:18 +01:00
|
|
|
|
2018-02-02 22:48:57 +01:00
|
|
|
"github.com/lbryio/reflector.go/cmd"
|
2018-01-29 20:37:26 +01:00
|
|
|
|
2018-01-24 17:45:18 +01:00
|
|
|
log "github.com/sirupsen/logrus"
|
2017-08-11 00:25:42 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func checkErr(err error) {
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2018-01-31 02:15:21 +01:00
|
|
|
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)
|
2017-08-11 00:25:42 +02:00
|
|
|
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)
|
2017-08-11 00:25:42 +02:00
|
|
|
checkErr(err)
|
2018-01-29 20:37:26 +01:00
|
|
|
|
|
|
|
return c
|
2017-08-11 00:25:42 +02:00
|
|
|
}
|