disable geoip by default

pull/7026/head
Thibault Duplessis 2020-07-23 11:43:08 +02:00
parent 3d6bdfb159
commit 7af2b5a206
2 changed files with 11 additions and 9 deletions

View File

@ -184,7 +184,7 @@ bookmark {
actor.name = bookmark
}
geoip {
file = "data/GeoLite2-City.mmdb"
file = ""
cache_ttl = 20 minutes
}
security {

View File

@ -10,14 +10,16 @@ import lila.common.IpAddress
final class GeoIP(config: GeoIP.Config) {
private lazy val geoIp: Option[MaxMindIpGeo] =
try {
val m = MaxMindIpGeo(config.file, 0)
logger.info("MaxMindIpGeo is enabled")
m.some
} catch {
case e: java.io.FileNotFoundException =>
logger.info(s"MaxMindIpGeo is disabled: $e")
none
config.file.nonEmpty ?? {
try {
val m = MaxMindIpGeo(config.file, 0)
logger.info("MaxMindIpGeo is enabled")
m.some
} catch {
case e: java.io.FileNotFoundException =>
logger.info(s"MaxMindIpGeo is disabled: $e")
none
}
}
private val cache: LoadingCache[IpAddress, Option[Location]] =