Repository navigation
Add Community Engine ingress target - #2
Merged
Merged
Conversation
Adds a CeMailReceiver class that speaks CE's ActionMailbox-based ingress contract (raw RFC822 body, message/rfc822 content type, HTTP Basic Auth) instead of Discourse's own form-encoded /admin/email/handle_mail contract. Selected via MAIL_RECEIVER_TARGET=ce, reusing the existing DISCOURSE_API_KEY/DISCOURSE_API_USERNAME/DISCOURSE_MAIL_ENDPOINT env vars (semantics repurposed for the ce target) so boot's validation logic doesn't need to change. Also: rename the gemspec/gem name to bts_mail_receiver and drop the RubyGems publish CI job, since this fork isn't meant to publish under the upstream discourse_mail_receiver gem name.
ci.yml still referenced discourse_mail_receiver.gemspec after the prior commit renamed it to bts_mail_receiver.gemspec. Also reformats ce_mail_receiver.rb to match syntax_tree's expected style.
Redesigns the CE ingress target to support true multi-domain routing within a single container, rather than one target per container. - boot: CE_MAIL_DOMAINS (subset of MAIL_DOMAIN) routes those domains to a new "ce" Postfix pipe transport instead of "discourse". Discourse/CE credential validation now only runs conditionally, based on whether any domain actually routes to that target. - Dockerfile: defines the "ce" pipe transport, passing --target=ce to receive-mail (Discourse's existing transport is untouched). - receive-mail: selects the receiver class per-invocation from a --target=<name> flag (set per-transport, defaults to "discourse" for existing deployments that never pass it) instead of a container-wide env var. - CeMailReceiver: uses independently-named CE_API_KEY/CE_API_USERNAME/ CE_MAIL_ENDPOINT instead of reusing DISCOURSE_* names, since both targets' credentials can now coexist in the same container's env. Bypasses MailReceiverBase's validating constructor (which hardcodes DISCOURSE_* requirements) rather than modifying it, to avoid touching the base class's existing upstream test contract. This lets a single do-3 instance serve both bayofislands.newfoundlandlabrador.online (Discourse) and communityengine.app (CE) without needing a second IP.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
CeMailReceiver, speaking Community Engine's ActionMailbox-based ingress contract (raw RFC822 body,message/rfc822content type, HTTP Basic Auth) instead of Discourse's own form-encoded/admin/email/handle_mailcontractMAIL_RECEIVER_TARGET=ce, reusing the existingDISCOURSE_API_KEY/DISCOURSE_API_USERNAME/DISCOURSE_MAIL_ENDPOINTenv vars (semantics repurposed for thecetarget) soboot's validation logic doesn't need to change — see README for the exact mappingbts_mail_receiverand drops the RubyGems publish CI job, since this fork isn't meant to publish under the upstreamdiscourse_mail_receivergem nameContext
This is a BTS-owned fork of discourse/mail-receiver, used to receive inbound mail for both existing Discourse instances (unchanged behavior, default target) and Community Engine (new). The Discourse-target code path is untouched.
Test plan
bundle exec rspec— 20 examples, 0 failures (16 existing + 4 new)bundle exec rubocop— no offensesbundle exec stree check— all files match expected format