mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-29 10:12:34 +00:00
chore: Minor Housekeeping tasks (#3169)
- Limit Rack attack to production environments - Make the long-running data migration optional
This commit is contained in:
@@ -17,7 +17,6 @@ defaults: &defaults
|
||||
environment:
|
||||
- CC_TEST_REPORTER_ID: b1b5c4447bf93f6f0b06a64756e35afd0810ea83649f03971cbf303b4449456f
|
||||
- RAILS_LOG_TO_STDOUT: false
|
||||
- ENABLE_RACK_ATTACK: false
|
||||
jobs:
|
||||
build:
|
||||
<<: *defaults
|
||||
|
||||
@@ -85,4 +85,4 @@ ActiveSupport::Notifications.subscribe('throttle.rack_attack') do |_name, _start
|
||||
Rails.logger.info "[Rack::Attack][Blocked] remote_ip: \"#{payload[:request].remote_ip}\", path: \"#{payload[:request].path}\""
|
||||
end
|
||||
|
||||
Rack::Attack.enabled = ActiveModel::Type::Boolean.new.cast(ENV.fetch('ENABLE_RACK_ATTACK', true))
|
||||
Rack::Attack.enabled = Rails.env.production? ? ActiveModel::Type::Boolean.new.cast(ENV.fetch('ENABLE_RACK_ATTACK', true)) : false
|
||||
|
||||
@@ -4,12 +4,9 @@ class AddOnlineStatusToAccountUsers < ActiveRecord::Migration[6.1]
|
||||
t.integer :availability, default: 0, null: false
|
||||
t.boolean :auto_offline, default: true, null: false
|
||||
end
|
||||
|
||||
update_existing_user_availability
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# run as a seperate data migration if you want to migrate the user statuses
|
||||
def update_existing_user_availability
|
||||
User.find_in_batches do |user_batch|
|
||||
user_batch.each do |user|
|
||||
|
||||
Reference in New Issue
Block a user