summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'glsamaker.go')
-rw-r--r--glsamaker.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/glsamaker.go b/glsamaker.go
index 5c7f6ec..a4caa8f 100644
--- a/glsamaker.go
+++ b/glsamaker.go
@@ -25,17 +25,18 @@ func isCommand(command string) bool {
func main() {
- waitForPostgres()
-
errorLogFile := logger.CreateLogFile(config.LogFile())
defer errorLogFile.Close()
initLoggers(os.Stdout, errorLogFile)
if isCommand("--serve") {
+ waitForPostgres(10)
app.Serve()
} else if isCommand("--full-update") {
+ waitForPostgres(5)
cveimport.FullUpdate()
} else if isCommand("--update") {
+ waitForPostgres(7)
cveimport.Update()
} else {
printHelp()
@@ -55,6 +56,6 @@ func initLoggers(infoHandler io.Writer, errorHandler io.Writer) {
// TODO this has to be solved differently
// wait for postgres to come up
-func waitForPostgres() {
- time.Sleep(5 * time.Second)
+func waitForPostgres(seconds int) {
+ time.Sleep(time.Duration(seconds) * time.Second)
}