forked from Team-Ortix/StatusApp
22 lines
322 B
Go
22 lines
322 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io/ioutil"
|
|
)
|
|
|
|
type Config struct {
|
|
Targets []checkTarget
|
|
Port int
|
|
}
|
|
|
|
func ReadConfig(file string) (Config, error) {
|
|
bytes, err := ioutil.ReadFile(file)
|
|
if err != nil {
|
|
return Config{}, err
|
|
}
|
|
var result Config
|
|
err = json.Unmarshal(bytes, &result)
|
|
return result, err
|
|
}
|