summaryrefslogtreecommitdiff
blob: bfbcd0b7dbdc9913a87fc517ab987b0858190c60 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package main

import (
	"flag"
	"go-gentoo/pkg/app"
	"go-gentoo/pkg/config"
	"go-gentoo/pkg/logger"
	"io"
	"io/ioutil"
	"os"
	"time"
)

func main() {

	//waitForPostgres()

	errorLogFile := logger.CreateLogFile(config.LogFile())
	defer errorLogFile.Close()
	initLoggers(os.Stdout, errorLogFile)

	serve := flag.Bool("serve", false, "Start serving the application")
	help := flag.Bool("help", false, "Print the usage of this application")
	flag.Parse()

	if *serve {
		app.Serve()
	}

	if *help {
		flag.PrintDefaults()
	}
}

// initialize the loggers depending on whether
// config.debug is set to true
func initLoggers(infoHandler io.Writer, errorHandler io.Writer) {
	if config.Debug() == "true" {
		logger.Init(os.Stdout, infoHandler, errorHandler)
	} else {
		logger.Init(ioutil.Discard, infoHandler, errorHandler)
	}
}

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

// Login

// Logout

// Create New
//  - [optional] select project
//  - [optional] select expire
//  - [optional] select path

// View existing
//  - personal
//  - per Project
// => options per entry
//  - change expire
//  - delete
//  (- add new)