aboutsummaryrefslogtreecommitdiff
blob: b6b2465b4344b8cd176617d8f36246642502af48 (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
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("fullimport", false, "Start a full import, importing all mails")
	serve := flag.Bool("serve", false, "Start serving the web application")
	flag.Parse()

	if *fullImport {
		importer.FullImport()
	}

	if *serve {
		app.Serve()
	}

}

// TODO this has to be solved differently
// wait for postgres to come up
func waitForPostgres() {
	time.Sleep(4 * time.Second)
}