-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(smtp): use usestarttls
(match the docs)
#252
Conversation
Codecov Report
@@ Coverage Diff @@
## main #252 +/- ##
=======================================
Coverage 77.73% 77.73%
=======================================
Files 96 96
Lines 2866 2866
=======================================
Hits 2228 2228
Misses 468 468
Partials 170 170
Continue to review full report at Codecov.
|
@@ -42,9 +43,10 @@ var _ = Describe("the SMTP service", func() { | |||
}) | |||
When("parsing the configuration URL", func() { | |||
It("should be identical after de-/serialization", func() { | |||
testURL := "smtp://user:[email protected]:2225/?auth=None&encryption=ExplicitTLS&fromaddress=sender%40example.com&fromname=Sender&starttls=No&subject=Subject&toaddresses=rec1%40example.com%2Crec2%40example.com&usehtml=Yes" | |||
testURL := "smtp://user:[email protected]:2225/?auth=None&encryption=ExplicitTLS&fromaddress=sender%40example.com&fromname=Sender&subject=Subject&toaddresses=rec1%40example.com%2Crec2%40example.com&usehtml=Yes&usestarttls=No" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed why I had to move this to the end. This is Go doing its usual alphabetising of a map right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, actually Go randomizes the map order. But to make the tests repeatable, we sort the keys in alphabetical order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, must be the yaml encoder that alphabetises my maps then. Unless I have been extremely 'lucky' to have it alphabetised correctly every time I checked after a save
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it does, it has it's own map impl: https://pkg.go.dev/gopkg.in/yaml.v2#MapSlice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish v3 has a MapSlice so that I could choose the order when I save it. Had to make it save the file, then go through and check whether the blocks have been written in the correct order (they won't have been...), then bubble sort those blocks back to how it should be and save again! I did spend a while on ordering the maps, but then found out they were alphabetised and am calling that good enough
email was using `toaddress` instead of `toaddresses` added internal conversion from `usestarttls` to `starttls` for `notify` containrrr/shoutrrr#252
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for finding this!
It's an oversight in the docs generation. When the key doesn't match the field name it should make a note of that, instead of just assuming they will be same.
In any case, this looks good, apart from the breaking change, but that's easily fixed.
@@ -42,9 +43,10 @@ var _ = Describe("the SMTP service", func() { | |||
}) | |||
When("parsing the configuration URL", func() { | |||
It("should be identical after de-/serialization", func() { | |||
testURL := "smtp://user:[email protected]:2225/?auth=None&encryption=ExplicitTLS&fromaddress=sender%40example.com&fromname=Sender&starttls=No&subject=Subject&toaddresses=rec1%40example.com%2Crec2%40example.com&usehtml=Yes" | |||
testURL := "smtp://user:[email protected]:2225/?auth=None&encryption=ExplicitTLS&fromaddress=sender%40example.com&fromname=Sender&subject=Subject&toaddresses=rec1%40example.com%2Crec2%40example.com&usehtml=Yes&usestarttls=No" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, actually Go randomizes the map order. But to make the tests repeatable, we sort the keys in alphabetical order.
@all-contributors add @JosephKav for bug |
I've put up a pull request to add @JosephKav! 🎉 |
- `url_fields.username`, not `params.username` - fix some errors to show it's in params, not url_fields - remove internal conversion to `starttls` for email as shoutrrr fixed it containrrr/shoutrrr#252
…77) * build(deps): bump github.com/containrrr/shoutrrr from 0.5.3 to 0.6.0 Bumps [github.com/containrrr/shoutrrr](https://github.com/containrrr/shoutrrr) from 0.5.3 to 0.6.0. - [Release notes](https://github.com/containrrr/shoutrrr/releases) - [Changelog](https://github.com/containrrr/shoutrrr/blob/main/goreleaser.yml) - [Commits](containrrr/shoutrrr@v0.5.3...v0.6.0) --- updated-dependencies: - dependency-name: github.com/containrrr/shoutrrr dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * fix(notify): mattermost username harddefault + error printing - `url_fields.username`, not `params.username` - fix some errors to show it's in params, not url_fields - remove internal conversion to `starttls` for email as shoutrrr fixed it containrrr/shoutrrr#252 - `-test.notify` uses defaults+harddefaults Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Joseph Kavanagh <[email protected]>
The smtp docs mention
UseStartTLS
, but it doesn't acceptusestarttls
, it wantsstarttls
. AsUseStartTLS
is the Go var, it was probably designed to beusestarttls
as the key, so here's a PR for that.Thanks to @samcro1967 for spotting this in the issue for my PR that added Shoutrrr
release-argus/Argus#33 (comment)
Wasn't sure about how/whether you'd want to keep support for
starttls
for a while as it would show in the docs if I put it under keys, right?