Load config from disk|url, create incidents

- Resolve incidents after the monitor is up
- Example configuration
- Updated readme
This commit is contained in:
Matej Kramny
2015-03-18 22:58:45 +01:00
parent 44a9cf905f
commit 42237e9c86
9 changed files with 130 additions and 49 deletions

View File

@@ -33,9 +33,9 @@ func (incident *Incident) Send() {
var req *http.Request
if incident.Id == 0 {
req, err = http.NewRequest("POST", apiUrl + "/incidents", bytes.NewBuffer(jsonBytes))
req, err = http.NewRequest("POST", Config.API_Url + "/incidents", bytes.NewBuffer(jsonBytes))
} else {
req, err = http.NewRequest("PUT", apiUrl + "/incidents/" + strconv.Itoa(incident.Id), bytes.NewBuffer(jsonBytes))
req, err = http.NewRequest("PUT", Config.API_Url + "/incidents/" + strconv.Itoa(incident.Id), bytes.NewBuffer(jsonBytes))
}
if err != nil {
@@ -43,7 +43,7 @@ func (incident *Incident) Send() {
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Cachet-Token", apiToken)
req.Header.Set("X-Cachet-Token", Config.API_Token)
client := &http.Client{}
resp, err := client.Do(req)