File tree Expand file tree Collapse file tree 7 files changed +16
-7
lines changed
Expand file tree Collapse file tree 7 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ Download the most suitable build for your system from the `releases`. This will
4747
4848``` Shell
4949sudo mkdir -p /var/www/ip-location-api
50- sudo wget -q -O /var/www/ip-location-api/ip-location-api https://github.com/paul-norman/ip-location-api/releases/download/v1.0.0 /ip-location-api-linux-x64.bin
50+ sudo wget -q -O /var/www/ip-location-api/ip-location-api https://github.com/paul-norman/ip-location-api/releases/latest/download /ip-location-api-linux-x64.bin
5151sudo chmod +x /var/www/ip-location-api/ip-location-api
5252```
5353
@@ -64,6 +64,8 @@ cd /var/www/ip-location-api
6464sudo ./ip-location-api
6565```
6666
67+ ** It's probably a good idea to start the system up manually like this on the first run** because it will allow you to see the data loading progress / any problems. After that, using a service is a good idea.
68+
6769## Configuration
6870
6971Configuration is handled by an environmental (` .env ` ) file. Example files for each database type exist in the ` .env.sample ` directory. All database types share some information:
Original file line number Diff line number Diff line change 11package main
22
33import (
4+ "embed"
45 "net"
56 "os"
67)
78
9+ //go:embed structure/*.sql
10+ var dbStructures embed.FS
11+
812func dbConnect () {
913 switch os .Getenv ("DB_TYPE" ) {
1014 case "postgres" : postgresConnect ()
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ require (
2323 github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
2424 github.com/seancfoley/bintree v1.3.1 // indirect
2525 go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
26- golang.org/x/sys v0.22 .0 // indirect
26+ golang.org/x/sys v0.23 .0 // indirect
2727 modernc.org/libc v1.56.0 // indirect
2828 modernc.org/mathutil v1.6.0 // indirect
2929 modernc.org/memory v1.8.0 // indirect
Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
4545golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M =
4646golang.org/x/sync v0.7.0 /go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk =
4747golang.org/x/sys v0.6.0 /go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg =
48- golang.org/x/sys v0.22 .0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI =
49- golang.org/x/sys v0.22 .0 /go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA =
48+ golang.org/x/sys v0.23 .0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM =
49+ golang.org/x/sys v0.23 .0 /go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA =
5050golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg =
5151golang.org/x/tools v0.23.0 /go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI =
5252gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA =
Original file line number Diff line number Diff line change @@ -259,7 +259,8 @@ func mysqlSaveCities(cities []IpCity) {
259259}
260260
261261func mysqlFile (sqlPath string ) {
262- sqlBytes , err := os .ReadFile (sqlPath )
262+ sqlBytes , err := dbStructures .ReadFile (sqlPath )
263+ //sqlBytes, err := os.ReadFile(sqlPath)
263264 if err != nil {
264265 panic (err )
265266 }
Original file line number Diff line number Diff line change @@ -315,7 +315,8 @@ func fixPostgresVars(sqlString string) string {
315315}
316316
317317func postgresFile (sqlPath string ) {
318- sqlBytes , err := os .ReadFile (sqlPath )
318+ sqlBytes , err := dbStructures .ReadFile (sqlPath )
319+ //sqlBytes, err := os.ReadFile(sqlPath)
319320 if err != nil {
320321 panic (err )
321322 }
Original file line number Diff line number Diff line change @@ -351,7 +351,8 @@ func sqliteSaveCities(cities []IpCity) {
351351}
352352
353353func sqliteFile (sqlPath string ) {
354- sqlBytes , err := os .ReadFile (sqlPath )
354+ sqlBytes , err := dbStructures .ReadFile (sqlPath )
355+ //sqlBytes, err := os.ReadFile(sqlPath)
355356 if err != nil {
356357 panic (err )
357358 }
You can’t perform that action at this time.
0 commit comments