discourse/db/fixtures/992_push_api_secret_key.rb
David Taylor 1aa8f702d8
DEV: Move bootstrap site settings from initializers to seeds (#39942)
Previously, the VAPID keypair, `push_api_secret_key`, and the
`global_notice` / `has_login_hint` "Congratulations, you installed
Discourse!" banner were generated by `to_prepare` blocks in three
different Rails initializers (`005-site_settings.rb`,
`006-ensure_login_hint.rb`, `100-push-notifications.rb`), which fired on
every boot and silently rescued when the DB schema wasn't ready.

This change moves each block into its own seed fixture. These are run on
each `db:migrate` invocation, which is more than frequent enough for all
these cases.

Extracted from https://github.com/discourse/discourse/pull/39788.
2026-05-13 10:07:54 +01:00

5 lines
186 B
Ruby
Vendored

# frozen_string_literal: true
unless String === SiteSetting.push_api_secret_key && SiteSetting.push_api_secret_key.length == 32
SiteSetting.push_api_secret_key = SecureRandom.hex
end