mirror of
https://github.com/discourse/discourse.git
synced 2024-12-14 19:26:28 +08:00
fa2a5f6f56
Sometimes we would like to create a base image without any DB access, this assists in creating custom base images with custom plugins that already includes `public/assets` Following this change set you can run: ``` SPROCKETS_CONCURRENT=1 DONT_PRECOMPILE_CSS=1 SKIP_DB_AND_REDIS=1 RAILS_ENV=production bin/rake assets:precompile ``` Then it is straight forward to create a base image without needing a DB or Redis.
18 lines
578 B
Ruby
18 lines
578 B
Ruby
# frozen_string_literal: true
|
|
|
|
return if GlobalSetting.skip_db?
|
|
|
|
require_dependency 'webpush'
|
|
|
|
if SiteSetting.vapid_public_key.blank? || SiteSetting.vapid_private_key.blank? || SiteSetting.vapid_public_key_bytes.blank?
|
|
vapid_key = Webpush.generate_key
|
|
SiteSetting.vapid_public_key = vapid_key.public_key
|
|
SiteSetting.vapid_private_key = vapid_key.private_key
|
|
end
|
|
|
|
SiteSetting.vapid_public_key_bytes = Base64.urlsafe_decode64(SiteSetting.vapid_public_key).bytes.join("|")
|
|
|
|
DiscourseEvent.on(:user_logged_out) do |user|
|
|
PushNotificationPusher.clear_subscriptions(user)
|
|
end
|