Browse Source

Изменено логирование количества найденных итемов. Изменена логика открытия конфигурационного файла, теперь, если не задано, то используется файл по-умолчанию.

develop
parent
commit
ef477063d2
  1. 8
      main.go

8
main.go

@ -40,10 +40,11 @@ func main() {
log.Println("Flags processed") log.Println("Flags processed")
if options.ConfigPath == "" { if options.ConfigPath == "" {
log.Fatalf("Config path not found in options!") log.Println("Config path not found in options! Use default from /etc/ssender/config.yml")
} } else {
log.Printf("Config from: %s\n", options.ConfigPath) log.Printf("Config from: %s\n", options.ConfigPath)
ConfigPath = options.ConfigPath ConfigPath = options.ConfigPath
}
// Get config // Get config
cfg, err := config.NewConfig(ConfigPath) cfg, err := config.NewConfig(ConfigPath)
@ -66,11 +67,12 @@ func main() {
} }
} }
//Find new items // Find new items
sendItems, err := db.FindItems(*rss, cfg.Dbpath) sendItems, err := db.FindItems(*rss, cfg.Dbpath)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
log.Printf("Found %d new items to send\n", len(sendItems.ItemList))
if len(sendItems.ItemList) > 0 { if len(sendItems.ItemList) > 0 {
// Run send data depended on configuration options // Run send data depended on configuration options

Loading…
Cancel
Save