-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (28 loc) · 695 Bytes
/
main.go
File metadata and controls
34 lines (28 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"flag"
"log"
"github.com/grubastik/flat-search/aggregator"
"github.com/grubastik/flat-search/config"
"github.com/grubastik/flat-search/db"
"github.com/grubastik/flat-search/email"
)
func main() {
log.Println("start")
cfg := config.MustNewConfig(*flag.String("config", "./config.json", "Path to the config file"))
storage, err := db.NewDb(cfg)
if err != nil {
log.Fatal(err, "can't open DB")
}
defer storage.Close()
err = storage.Db.Ping()
if err != nil {
log.Fatal(err, "ping error")
}
email.NewConnection(cfg)
err = aggregator.ProcessAdverts(cfg.GetSreality())
if err != nil {
log.Fatal(err, "process adverts error")
}
log.Println("end")
}