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.
This commit is contained in:
David Taylor 2023-06-01 21:46:49 +01:00 committed by GitHub
parent 9616a08fa6
commit 0330f51d75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -1,9 +1,7 @@
# frozen_string_literal: true
desc "downloads MaxMind's GeoLite2-City database"
task "maxminddb:get" do
require "discourse_ip_info"
task "maxminddb:get" => "environment" do
puts "Downloading MaxMindDb's GeoLite2-City..."
DiscourseIpInfo.mmdb_download("GeoLite2-City")