feature: making Slack action URL configurable #1535
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The "Open view" action in the Slack alert it refers to
http://localhost
instead of the server where it is deployed.Solution
Add a
Host
field to the[slack]
section ofconfig.toml
. If this field is non-empty use it as the base for the "Open view" Action URL, otherwise default tohttp://localhost:{port}
.Changes Made
Host
field to theSlackConfig
structslack.Attachment
creation code into its own functionhost
parameter to thehitSlackWebhook
functionwebhook_test.go
to test the newcreateSlackAttachment
functionconfig_test.go
to test the newHost
fieldHow to Test
host
inconfig.toml
tohttps://example.com
https://example.com/inventory?view={viewId}
Screenshots
None.
Notes
None.
Checklist
Reviewers
@[username of the reviewer]