Adjust downloader functions

This commit is contained in:
Tom Neuber 2024-03-02 10:55:27 +01:00
parent 06eaff6503
commit ca09e5efc5
Signed by: tom
GPG key ID: F17EFE4272D89FF6
2 changed files with 39 additions and 24 deletions

View file

@ -24,8 +24,13 @@ func main() {
}
handleGracefulShutdown()
if !downloader.FileExists(appSettings.DataFile) {
downloader.DownloadFile(appSettings.DataFile, appSettings.DataURL)
ctx := downloader.NewContext(appSettings.DataFile, appSettings.DataURL)
if !ctx.FileExists() {
if err := ctx.Download(); err != nil {
panic(err)
}
fmt.Printf("Saved file to %s\n", ctx.Filename)
}
fmt.Printf("Import data from file...\r")