Use config_for for VAPID key storage (#34845)

This commit is contained in:
Matt Jankowski 2025-05-30 03:00:33 -04:00 committed by GitHub
parent a1c260696f
commit f7a3dd0e38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 42 additions and 40 deletions

View file

@ -40,10 +40,10 @@ Rails.application.configure do
# Override default file logging in favor of STDOUT logging in dev environment
config.logger = ActiveSupport::TaggedLogging.logger($stdout, formatter: config.log_formatter)
# Generate random VAPID keys
# Generate random VAPID keys when needed
Webpush.generate_key.tap do |vapid_key|
config.x.vapid_private_key = vapid_key.private_key
config.x.vapid_public_key = vapid_key.public_key
config.x.vapid.private_key ||= vapid_key.private_key
config.x.vapid.public_key ||= vapid_key.public_key
end
# Don't care if the mailer can't send.