Skip to content

Commit e5c7274

Browse files
authored
Merge pull request #23 from VersusControl/feature/sns
(feature): add queries overwrite configuration for sns path
2 parents 65ff4bd + 2bbeb02 commit e5c7274

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

pkg/controllers/sns.go

+15-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,21 @@ func SNS(c *fiber.Ctx) error {
6262
return c.Status(400).SendString("Invalid message content")
6363
}
6464

65-
return services.CreateIncident("", content) // teamID as empty string
65+
// If query parameters exist, get the value to overwrite the default configuration
66+
var err error
67+
68+
if len(c.Queries()) > 0 {
69+
overwriteVaule := c.Queries()
70+
err = services.CreateIncident("", content, &overwriteVaule)
71+
} else {
72+
err = services.CreateIncident("", content)
73+
}
74+
75+
if err != nil {
76+
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{"error": err.Error()})
77+
}
78+
79+
return c.Status(fiber.StatusCreated).JSON(fiber.Map{"status": "Incident created"})
6680
}
6781
}
6882

src/getting_started.md

+11
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ alert:
8383
subject: ${EMAIL_SUBJECT} # From environment
8484
template_path: "config/email_message.tmpl"
8585

86+
queue:
87+
enable: true
88+
89+
# AWS SNS
90+
sns:
91+
enable: false
92+
https_endpoint_subscription_path: /sns # URI to receive SNS messages, e.g. ${host}:${port}/sns or ${https_endpoint_subscription}/sns
93+
# Options If you want to automatically create an sns subscription
94+
https_endpoint_subscription: ${SNS_HTTPS_ENDPOINT_SUBSCRIPTION} # If the user configures an HTTPS endpoint, then an SNS subscription will be automatically created, e.g. https://your-domain.com
95+
topic_arn: ${SNS_TOPIC_ARN}
96+
8697
```
8798
## Environment Variables
8899

0 commit comments

Comments
 (0)