StatusApp/config.go

22 lines
322 B
Go

package main
import (
"encoding/json"
"io/ioutil"
)
type Config struct {
Targets []checkTarget
2020-04-23 07:42:16 +07:00
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
}