start funOnStart async

This commit is contained in:
bakito 2021-10-25 18:55:38 +02:00
parent 0a5f6a4750
commit 620f555c90
No known key found for this signature in database
GPG key ID: FAF93C1C384DD6B4

View file

@ -54,12 +54,24 @@ func Sync(cfg *types.Config) error {
}
}
if cfg.RunOnStart {
go func() {
l.Info("Running sync on startup")
w.sync()
}()
}
if cfg.API.Port != 0 {
if cfg.RunOnStart {
go func() {
l.Info("Running sync on startup")
w.sync()
}()
}
w.listenAndServe()
} else if cfg.RunOnStart {
l.Info("Running sync on startup")
w.sync()
}
if cfg.API.Port != 0 {
w.listenAndServe()
}
return nil
}