vapid.rb 816 B

12345678910111213141516
  1. # frozen_string_literal: true
  2. Rails.application.configure do
  3. # You can generate the keys using the following command (first is the private key, second is the public one)
  4. # You should only generate this once per instance. If you later decide to change it, all push subscription will
  5. # be invalidated, requiring the users to access the website again to resubscribe.
  6. #
  7. # 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)
  8. #
  9. # For more information visit https://rossta.net/blog/using-the-web-push-api-with-vapid.html
  10. if Rails.env.production?
  11. config.x.vapid_private_key = ENV['VAPID_PRIVATE_KEY']
  12. config.x.vapid_public_key = ENV['VAPID_PUBLIC_KEY']
  13. end
  14. end