mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-06-18 22:05:43 +08:00
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.
5 lines
186 B
Ruby
Vendored
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
|