discourse/lib/tasks/maxminddb.rake
David Taylor 0330f51d75
DEV: Ensure maxminddb:fetch works as standalone task (#21893)
`DiscourseIpInfo` expects zeitwerk auto-loading to be available, so we need to ensure the rake task loads the full rails environment. Normally we run this task as part of assets:precompile, so the app is already initialized. This commit only affects the case where the maxmind task is run directly.
2023-06-01 21:46:49 +01:00

11 lines
323 B
Ruby

# frozen_string_literal: true
desc "downloads MaxMind's GeoLite2-City database"
task "maxminddb:get" => "environment" do
puts "Downloading MaxMindDb's GeoLite2-City..."
DiscourseIpInfo.mmdb_download("GeoLite2-City")
puts "Downloading MaxMindDb's GeoLite2-ASN..."
DiscourseIpInfo.mmdb_download("GeoLite2-ASN")
end