2015-08-21 17:27:26 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"fmt"
|
|
|
|
"io/ioutil"
|
|
|
|
"encoding/json"
|
2015-08-23 03:20:58 +00:00
|
|
|
"./core"
|
|
|
|
"./engine"
|
2015-08-21 17:27:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
file, err := ioutil.ReadFile("./config.json")
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(fmt.Sprintf("%v\n", err))
|
|
|
|
}
|
|
|
|
|
2015-08-23 03:20:58 +00:00
|
|
|
c := core.Config{}
|
2015-08-21 17:27:26 +00:00
|
|
|
json.Unmarshal(file, &c)
|
|
|
|
|
2015-08-23 03:20:58 +00:00
|
|
|
engines := make([]*core.Engine, 0)
|
2015-08-23 00:35:33 +00:00
|
|
|
|
2015-08-23 03:20:58 +00:00
|
|
|
for _, check := range c.Checks {
|
|
|
|
engines = append(engines, engine.EngineFromConfig(check))
|
|
|
|
}
|
2015-08-23 00:35:33 +00:00
|
|
|
|
2015-08-23 03:20:58 +00:00
|
|
|
for _, engine := range engines {
|
|
|
|
engine.Run()
|
2015-08-21 17:27:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
select{}
|
|
|
|
}
|