Skip to content

Source vapid subject from vapid_subject env var#2951

Open
ryanharkins wants to merge 1 commit into
basecamp:mainfrom
ryanharkins:make-vapid-subject-easily-configurable
Open

Source vapid subject from vapid_subject env var#2951
ryanharkins wants to merge 1 commit into
basecamp:mainfrom
ryanharkins:make-vapid-subject-easily-configurable

Conversation

@ryanharkins

Copy link
Copy Markdown

Problem

The VAPID JWT subject defaulted to mailto:support@fizzy.do. It could already be overridden by setting config.x.vapid.subject via the initializers/vapid.rb (the merge in vapid_identification method 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 the support@fizzy.do address.

Fix

This change mainly makes the subject more visible for users to be able to change, it also keeps the current default in case the env var is not set.

Copilot AI review requested due to automatic review settings June 30, 2026 11:12

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 subject default from WebPush::Notification#vapid_identification so it relies purely on Rails configuration.
  • Add VAPID_SUBJECT (with default fallback) to config/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.

Comment thread config/initializers/vapid.rb Outdated
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.
@ryanharkins ryanharkins force-pushed the make-vapid-subject-easily-configurable branch from da49db5 to 760a5b0 Compare July 7, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants