-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
add MAILGUN_BASE_URI #2935
add MAILGUN_BASE_URI #2935
Conversation
BundleMonUnchanged files (7)
No change in files bundle size Final result: ✅ View report in BundleMon website ➡️ |
@@ -334,6 +334,10 @@ case mailer_adapter do | |||
api_key: get_var_from_path_or_env(config_dir, "MAILGUN_API_KEY"), | |||
domain: get_var_from_path_or_env(config_dir, "MAILGUN_DOMAIN") | |||
|
|||
if mailgun_base_uri = get_var_from_path_or_env(config_dir, "MAILGUN_BASE_URI") do | |||
config :plausible, Plausible.Mailer, base_uri: mailgun_base_uri | |||
end |
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'm doing it this way because the alternatives either don't work:
config :plausible, Plausible.Mailer,
adapter: Bamboo.MailgunAdapter,
hackney_opts: [recv_timeout: :timer.seconds(10)],
api_key: get_var_from_path_or_env(config_dir, "MAILGUN_API_KEY"),
domain: get_var_from_path_or_env(config_dir, "MAILGUN_DOMAIN"),
# if MAILGUN_BASE_URI is not set, `base_uri: nil` and it causes a runtime error during delivery
# https://github.com/thoughtbot/bamboo/blob/53bd3929da6778ccf4ec7817070ec19f2b12b772/lib/bamboo/adapters/mailgun_adapter.ex#L63-L65
# it would've worked if base_uri used `Application.get_env(:bamboo, :base_uri) || @default_base_uri` instead.
base_uri: get_var_from_path_or_env(config_dir, "MAILGUN_BASE_URI")
Or require more maintenance:
config :plausible, Plausible.Mailer,
adapter: Bamboo.MailgunAdapter,
hackney_opts: [recv_timeout: :timer.seconds(10)],
api_key: get_var_from_path_or_env(config_dir, "MAILGUN_API_KEY"),
domain: get_var_from_path_or_env(config_dir, "MAILGUN_DOMAIN"),
# this works now but would require us to keep an eye on newer api version and keep it up to date
base_uri: get_var_from_path_or_env(config_dir, "MAILGUN_BASE_URI", "https://api.mailgun.net/v3")
Thank you for this work. I started working on a similar PR until I saw this one. So I've written some docs for this PR and sent out a PR for the docs side plausible/docs#396 |
@tenfourty thank you! |
Changes
This PR adds
MAILGUN_BASE_URI
support as suggested in #2649 (comment)Tests
Changelog
Documentation
Dark mode