Skip to content

Commit

Permalink
ref: change database path
Browse files Browse the repository at this point in the history
  • Loading branch information
SharkEzz committed Dec 31, 2021
1 parent ac34966 commit 86ff5e9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
database/local.db
local.db
sattrack
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ func main() {
log.Println("Starting", appName, version)
flag.Parse()

db := database.Init("database/local.db")
db := database.Init("./local.db")

if *shouldUpdate {
services.UpdateDatabase(*tleListURL, db)
} else {
log.Println("Not updating TLE database (flag -update not given)")
}

log.Println("Loaded", services.GetTLECount(db), "TLEs")

validator := validator.New()

app := fiber.New(fiber.Config{
Expand Down
8 changes: 8 additions & 0 deletions services/TLEService.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,11 @@ func GetTLEFromDatabase(catNbr int, db *gorm.DB) (*sgp4.TLE, error) {

return tle, nil
}

func GetTLECount(db *gorm.DB) int64 {
var count int64

db.Model(&models.TLE{}).Count(&count)

return count
}

0 comments on commit 86ff5e9

Please sign in to comment.