1
0
Pārlūkot izejas kodu

Add flag: startup

poesty 9 mēneši atpakaļ
vecāks
revīzija
b787c390ff
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. 4 1
      rss2hook.go

+ 4 - 1
rss2hook.go

@@ -150,6 +150,7 @@ func main() {
 	config := flag.String("config", "config.json", "The path to the configuration-file to read")
 	timeout := flag.Duration("timeout", 5*time.Second, "The timeout used for fetching the remote feeds")
 	schedule := flag.String("schedule", "@every 5m", "The cron schedule for fetching the remote feeds")
+	startup := flag.Bool("startup", false, "Run on startup (first check)")
 	flag.Parse()
 
 	// Setup the default timeout and TTL
@@ -187,7 +188,9 @@ func main() {
 				return
 			}
 			// TODO: URL validiy checks
-			// feed.Unread = 0
+			if !*startup {
+				feed.Unread = 0
+			}
 			feeds[i] = *feed
 		}(i, ent)
 	}