fix: GeoIP opcional, no paniquea si falta GeoLite2-City.mmdb

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-20 10:22:55 -05:00
co-authored by Claude Sonnet 4.6
parent e28e2823dc
commit d66fe95514
2 changed files with 7 additions and 5 deletions
+4 -2
View File
@@ -52,8 +52,10 @@ func (cfg *AppConfig) Setup() {
modelFile := filepath.Join(cfg.Server.AssetPath, "rbac_model.conf")
cfg.Auth.Setup(cfg.Database.DB, modelFile)
}
path := MakeDir(filepath.Join(cfg.Server.AssetPath, "GeoLite2-City.mmdb"))
cfg.GeoIP = ip.NewGeoIpDB(path)
mmdbPath := filepath.Join(cfg.Server.AssetPath, "GeoLite2-City.mmdb")
if _, err := os.Stat(mmdbPath); err == nil {
cfg.GeoIP = ip.NewGeoIpDB(MakeDir(mmdbPath))
}
}
func (cfg *AppConfig) PrepareLog() {