mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-30 18:47:51 +00:00
chore: Improve logging for ip look up and audit logs [CW-2145] (#7512)
Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
@@ -19,6 +19,9 @@ class Api::V1::Accounts::AuditLogsController < Api::V1::Accounts::EnterpriseAcco
|
|||||||
else
|
else
|
||||||
Current.account.associated_audits.none
|
Current.account.associated_audits.none
|
||||||
end
|
end
|
||||||
|
return if audit_logs_enabled?
|
||||||
|
|
||||||
|
Rails.logger.warn("Audit logs are disabled for account #{Current.account.id}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def audit_logs_enabled?
|
def audit_logs_enabled?
|
||||||
|
|||||||
@@ -5,9 +5,12 @@ namespace :ip_lookup do
|
|||||||
next if File.exist?(GeocoderConfiguration::LOOK_UP_DB)
|
next if File.exist?(GeocoderConfiguration::LOOK_UP_DB)
|
||||||
|
|
||||||
ip_lookup_api_key = ENV.fetch('IP_LOOKUP_API_KEY', nil)
|
ip_lookup_api_key = ENV.fetch('IP_LOOKUP_API_KEY', nil)
|
||||||
next if ip_lookup_api_key.blank?
|
if ip_lookup_api_key.blank?
|
||||||
|
Rails.logger.info '[rake ip_lookup:setup] IP_LOOKUP_API_KEY empty. Skipping geoip database setup'
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
puts '[rake ip_lookup:setup] Fetch GeoLite2-City database'
|
Rails.logger.info '[rake ip_lookup:setup] Fetch GeoLite2-City database'
|
||||||
|
|
||||||
begin
|
begin
|
||||||
base_url = 'https://download.maxmind.com/app/geoip_download'
|
base_url = 'https://download.maxmind.com/app/geoip_download'
|
||||||
@@ -25,9 +28,9 @@ namespace :ip_lookup do
|
|||||||
f.print entry.read
|
f.print entry.read
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
puts '[rake ip_lookup:setup] Fetch complete'
|
Rails.logger.info '[rake ip_lookup:setup] Fetch complete'
|
||||||
rescue StandardError => e
|
rescue StandardError => e
|
||||||
puts "[rake ip_lookup:setup] #{e.message}"
|
Rails.logger.error "[rake ip_lookup:setup] #{e.message}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user