21 lines
303 B
Go
21 lines
303 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io/ioutil"
|
|
)
|
|
|
|
type Config struct {
|
|
Targets []checkTarget
|
|
}
|
|
|
|
func ReadConfig(file string) (Config, error) {
|
|
bytes, err := ioutil.ReadFile(file)
|
|
if err != nil {
|
|
return Config{}, err
|
|
}
|
|
var result Config
|
|
json.Unmarshal(bytes, &result)
|
|
return result, nil
|
|
}
|