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

@ -1,16 +0,0 @@
# frozen_string_literal: true
Rails.application.configure do
# You can generate the keys using the following command (first is the private key, second is the public one)
# You should only generate this once per instance. If you later decide to change it, all push subscription will
# be invalidated, requiring the users to access the website again to resubscribe.
#
# Generate with `bundle exec rails mastodon:webpush:generate_vapid_key` task (`docker-compose run --rm web bundle exec rails mastodon:webpush:generate_vapid_key` if you use docker compose)
#
# For more information visit https://rossta.net/blog/using-the-web-push-api-with-vapid.html
if Rails.env.production?
config.x.vapid_private_key = ENV['VAPID_PRIVATE_KEY']
config.x.vapid_public_key = ENV['VAPID_PUBLIC_KEY']
end
end