Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #58 from fastly/fgsch/issue_56_2
Browse files Browse the repository at this point in the history
Also check when creating the WAF logging endpoint
  • Loading branch information
fgsch committed Nov 9, 2018
2 parents 322b93a + 90f6f3d commit 5a90d56
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions waflyctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ func FastlyLogging(client fastly.Client, serviceID string, version int, config T
Info.Println("Created request logging endpoint: " + config.Weblog.Name)

case strings.Contains(err.Error(), "Duplicate record"):
// nothing
Info.Println("Request logging endpoint " + config.Weblog.Name + " already exists. Skipping.")

default:
fmt.Print(err)
Expand All @@ -547,11 +547,19 @@ func FastlyLogging(client fastly.Client, serviceID string, version int, config T
MessageType: "blank",
Placement: "waf_debug",
})
if err != nil {

switch {
case err == nil:
Info.Println("Created WAF logging endpoint: " + config.Waflog.Name)

case strings.Contains(err.Error(), "Duplicate record"):
Info.Println("WAF logging endpoint " + config.Waflog.Name + " already exists. Skipping.")

default:
fmt.Print(err)
return false
}
Info.Println("Created WAF logging endpoint: " + config.Waflog.Name)

return true
}

Expand Down

0 comments on commit 5a90d56

Please sign in to comment.