mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 19:02:40 +08:00
UX: Show on IP lookup if MaxMind key is missing (#18993)
as discussed in https://meta.discourse.org/t/maxminddb-not-found-error/148512/7. shows a warning to the admin if no license for maxmind is found
This commit is contained in:
@ -11,8 +11,10 @@ class DiscourseIpInfo
|
||||
end
|
||||
|
||||
def open_db(path)
|
||||
@loc_mmdb = mmdb_load(File.join(path, "GeoLite2-City.mmdb"))
|
||||
@asn_mmdb = mmdb_load(File.join(path, "GeoLite2-ASN.mmdb"))
|
||||
unless GlobalSetting.maxmind_license_key.blank?
|
||||
@loc_mmdb = mmdb_load(File.join(path, "GeoLite2-City.mmdb"))
|
||||
@asn_mmdb = mmdb_load(File.join(path, "GeoLite2-ASN.mmdb"))
|
||||
end
|
||||
@cache = LruRedux::ThreadSafeCache.new(2000)
|
||||
end
|
||||
|
||||
@ -105,6 +107,8 @@ class DiscourseIpInfo
|
||||
message: "IP #{ip} could not be looked up in MaxMind GeoLite2-City database.",
|
||||
)
|
||||
end
|
||||
else
|
||||
ret[:no_license] = true
|
||||
end
|
||||
|
||||
if @asn_mmdb
|
||||
|
Reference in New Issue
Block a user