blob: 7cbba67b6e38fc225a41203663e24b38e738702e (
plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
package main
import (
"archives/pkg/app"
"archives/pkg/database"
"archives/pkg/importer"
"flag"
"fmt"
"time"
)
var flagvar int
func main() {
fmt.Println("Starting Gentoo Archives.")
waitForPostgres()
database.Connect()
defer database.DBCon.Close()
// main part
fullImport := flag.Bool("full-import", false, "Start a full import, importing all mails")
incrementalImport := flag.Bool("incremental-import", false, "Start a incremental import, importing only new mails")
serve := flag.Bool("serve", false, "Start serving the web application")
flag.Parse()
if *fullImport {
importer.FullImport()
}
if *incrementalImport {
importer.IncrementalImport()
}
if *serve {
app.Serve()
}
importer.WaitGroup.Wait()
}
// TODO this has to be solved differently
// wait for postgres to come up
func waitForPostgres() {
time.Sleep(4 * time.Second)
}
|