From 9c04b53cdfaaaac9bc5298696fe1bc8ac1123172 Mon Sep 17 00:00:00 2001 From: Arnav Gupta Date: Fri, 9 Aug 2024 20:11:24 +0530 Subject: [PATCH] fix maxmind finding Signed-off-by: Arnav Gupta --- go.sum | 2 -- onepixel.local.env | 12 +++++++----- src/db/init.go | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/go.sum b/go.sum index 87c1986..cc8db3c 100644 --- a/go.sum +++ b/go.sum @@ -749,8 +749,6 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/championswimmer/duckdb-driver v0.2.1 h1:1wjIhRLE3NQjwMLntAPRXw5IdkxdMPkDxxr7i3vW4vE= -github.com/championswimmer/duckdb-driver v0.2.1/go.mod h1:zoGrzT9RpdOfCEOCDx4fZ1s87Rpx3D1QUIEzwxHWGLo= github.com/championswimmer/duckdb-driver v0.2.2 h1:XG3La7Utu5ta25dK0XbKzKTTHcDI68QPmi+5rdeEox0= github.com/championswimmer/duckdb-driver v0.2.2/go.mod h1:zoGrzT9RpdOfCEOCDx4fZ1s87Rpx3D1QUIEzwxHWGLo= github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw= diff --git a/onepixel.local.env b/onepixel.local.env index 273af62..765c997 100644 --- a/onepixel.local.env +++ b/onepixel.local.env @@ -5,14 +5,16 @@ PORT=3000 ADMIN_USER_EMAIL=admin@onepixel.link DB_LOGGING=error -DB_DIALECT=postgres -DATABASE_URL="host=127.0.0.1 user=postgres password=postgres dbname=onepixel port=5432 sslmode=disable TimeZone=UTC" -USE_FILE_DB=false +DB_DIALECT=sqlite +DATABASE_URL=app.db +# DATABASE_URL="host=127.0.0.1 user=postgres password=postgres dbname=onepixel port=5432 sslmode=disable TimeZone=UTC" +USE_FILE_DB=true ADMIN_API_KEY="8DC4FCD4-DD71-4C18-B9C0-C38EF6790815" JWT_SIGNING_KEY="ECkLlR74HWIZTG4GAFsmBFoqO7Nr30Bc" JWT_DURATION_DAYS=90 -EVENTDB_DIALECT=clickhouse -EVENTDB_URL="clickhouse://clickhouse:clickhouse@127.0.0.1:9000/onepixel?dial_timeout=10s&read_timeout=20s" \ No newline at end of file +EVENTDB_DIALECT=duckdb +EVENTDB_URL=events.db +# EVENTDB_URL="clickhouse://clickhouse:clickhouse@127.0.0.1:9000/onepixel?dial_timeout=10s&read_timeout=20s" \ No newline at end of file diff --git a/src/db/init.go b/src/db/init.go index 5254571..1d93ff4 100644 --- a/src/db/init.go +++ b/src/db/init.go @@ -111,17 +111,17 @@ func GetGeoIPDB() *geoip2.Reader { // download file : https://git.io/GeoLite2-City.mmdb createGeoIPDbOnce.Do(func() { applogger.Warn("GeoIP: Initialising database") - fresh := utils.IsFileFresh(30, "/app/GeoLite2-City.mmdb") + fresh := utils.IsFileFresh(30, "./GeoLite2-City.mmdb") if !fresh { applogger.Error("GeoIP: GeoLite2-City.mmdb is not fresh; downloading again") lo.Try(func() error { - return os.Remove("/app/GeoLite2-City.mmdb") + return os.Remove("./GeoLite2-City.mmdb") }) - lo.Must0(utils.DownloadFile("https://git.io/GeoLite2-City.mmdb", "/app/GeoLite2-City.mmdb")) + lo.Must0(utils.DownloadFile("https://git.io/GeoLite2-City.mmdb", "./GeoLite2-City.mmdb")) applogger.Info("GeoIP: GeoLite2-City.mmdb downloaded") } - reader = lo.Must(geoip2.Open("/app/GeoLite2-City.mmdb")) + reader = lo.Must(geoip2.Open("./GeoLite2-City.mmdb")) })