From 0330f51d75b34c41666266d5fee4174b136be728 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Thu, 1 Jun 2023 21:46:49 +0100 Subject: [PATCH] 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. --- lib/tasks/maxminddb.rake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/tasks/maxminddb.rake b/lib/tasks/maxminddb.rake index ffb6a06514d..eb66f64a495 100644 --- a/lib/tasks/maxminddb.rake +++ b/lib/tasks/maxminddb.rake @@ -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")