From 8acaff9bbfa072a0b68a516255a713b4fcae4929 Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" Date: Fri, 9 Nov 2018 14:52:33 +0000 Subject: [PATCH] Ignore error if the logging endpoint is duplicated Fixes #56. --- waflyctl.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/waflyctl.go b/waflyctl.go index 461ddee..fa6befe 100644 --- a/waflyctl.go +++ b/waflyctl.go @@ -518,11 +518,18 @@ func FastlyLogging(client fastly.Client, serviceID string, version int, config T FormatVersion: 2, MessageType: "blank", }) - if err != nil { + + switch { + case err == nil: + Info.Println("Created request logging endpoint: " + config.Weblog.Name) + + case strings.Contains(err.Error(), "Duplicate record"): + // nothing + + default: fmt.Print(err) return false } - Info.Println("Created request logging endpoint: " + config.Weblog.Name) // create waf logging endpoint _, err = client.CreateSyslog(&fastly.CreateSyslogInput{