You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

21 lines
362 B

package main
import (
"encoding/json"
"os"
)
type Configuration struct {
Hosts []string `json:"hosts"`
}
func configuration(jsonFile string) (configuration Configuration, err error) {
fp, err := os.Open(jsonFile)
if err != nil {
return
}
decoder := json.NewDecoder(fp)
decoder.DisallowUnknownFields()
err = decoder.Decode(&configuration)
return
}