Source vapid subject from vapid_subject env var#2951
Open
ryanharkins wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Makes the Web Push VAPID JWT subject configurable via a dedicated VAPID_SUBJECT environment variable, while preserving the existing mailto:support@fizzy.do default. This improves self-hosted deploy visibility by moving the defaulting logic into the VAPID initializer instead of being implicit in the notification code.
Changes:
- Remove the hardcoded VAPID
subjectdefault fromWebPush::Notification#vapid_identificationso it relies purely on Rails configuration. - Add
VAPID_SUBJECT(with default fallback) toconfig/initializers/vapid.rb.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/web_push/notification.rb | Stops injecting a default VAPID subject in code; uses configured VAPID options as-is. |
| config/initializers/vapid.rb | Introduces VAPID_SUBJECT env var with a default to make configuration explicit. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Rails.application.configure do | ||
| config.x.vapid.private_key = ENV["VAPID_PRIVATE_KEY"] | ||
| config.x.vapid.public_key = ENV["VAPID_PUBLIC_KEY"] | ||
| config.x.vapid.subject = ENV.fetch("VAPID_SUBJECT", "mailto:support@fizzy.do") |
The VAPID JWT subject defaulted to `mailto:support@fizzy.do`. It could already be overridden by setting config.x.vapid.subject (the merge in vapid_identification took care of that), but for self-hosted deployments this wasn't obvious and was easily missed, so they'd silently ship the fizzy.do address. This change keeps the current default but lets the subject be overridden via an env var.
da49db5 to
760a5b0
Compare
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.
Problem
The VAPID JWT subject defaulted to
mailto:support@fizzy.do. It could already be overridden by settingconfig.x.vapid.subjectvia theinitializers/vapid.rb(the merge invapid_identificationmethod took care of that), but for self-hosted deployments this wasn't very obvious and could easily be missed, so it would be silently shipped with thesupport@fizzy.doaddress.Fix
This change mainly makes the
subjectmore visible for users to be able to change, it also keeps the current default in case the env var is not set.