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

@ -48,10 +48,11 @@ Rails.application.configure do
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Generate random VAPID keys
vapid_key = Webpush.generate_key
config.x.vapid_private_key = vapid_key.private_key
config.x.vapid_public_key = vapid_key.public_key
# 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
end
# Raise exceptions when a reorder occurs in in_batches
config.active_record.error_on_ignored_order = true