Skip to content

Commit da49db5

Browse files
committed
Source vapid subject from vapid_subject env var
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.
1 parent 88c4b88 commit da49db5

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

config/initializers/vapid.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Rails.application.configure do
22
config.x.vapid.private_key = ENV["VAPID_PRIVATE_KEY"]
33
config.x.vapid.public_key = ENV["VAPID_PUBLIC_KEY"]
4+
config.x.vapid.subject = ENV.fetch("VAPID_SUBJECT", "mailto:support@fizzy.do")
45
end

lib/web_push/notification.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ def deliver(connection: nil)
1515

1616
private
1717
def vapid_identification
18-
{ subject: "mailto:support@fizzy.do" }.merge \
19-
Rails.configuration.x.vapid.symbolize_keys
18+
Rails.configuration.x.vapid.symbolize_keys
2019
end
2120

2221
def encoded_message

0 commit comments

Comments
 (0)