1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-21 22:39:41 +02:00

refactor(api): refactor

This commit is contained in:
Anthony Lapenna 2017-02-07 16:26:12 +13:00
parent dc78ec5135
commit f129bf3e97
5 changed files with 152 additions and 81 deletions

View file

@ -24,11 +24,17 @@ func NewWatcher(endpointService portainer.EndpointService, syncInterval string)
// WatchEndpointFile starts a cron job to synchronize the endpoints from a file
func (watcher *Watcher) WatchEndpointFile(endpointFilePath string) error {
job := newEndpointSyncJob(endpointFilePath, watcher.EndpointService)
err := job.Sync()
if err != nil {
return err
}
watcher.Cron.AddJob("@every "+watcher.syncInterval, job)
err = watcher.Cron.AddJob("@every "+watcher.syncInterval, job)
if err != nil {
return err
}
watcher.Cron.Start()
return nil
}