-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
63 lines (45 loc) · 1.09 KB
/
main.go
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
package main
import (
"fmt"
"os"
"time"
"github.com/flashmob/go-guerrilla"
"github.com/rahulvramesh/mailbay-backend/drivers"
log "github.com/sirupsen/logrus"
_ "github.com/go-sql-driver/mysql"
)
func main() {
//forever loop
forever := make(chan bool)
// cfg := &guerrilla.AppConfig{LogFile: "mails.log"}
// sc := guerrilla.ServerConfig{
// ListenInterface: "127.0.0.1:2525",
// IsEnabled: true,
// }
// cfg.Servers = append(cfg.Servers, sc)
d := guerrilla.Daemon{}
_, err := d.LoadConfig("guerrillad.conf.json")
if err != nil {
fmt.Println("ReadConfig error", err)
}
//add
d.AddProcessor("SqlLite", drivers.SqlLiteProcessor)
err = d.Start()
if err != nil {
fmt.Println(err)
}
log.Println(" [*] Waiting for messages. To exit press CTRL+C")
<-forever
//**** ned to fix below area
log.Debug("Trying to shutdown")
go func() {
select {
// exit if graceful shutdown not finished in 60 sec.
case <-time.After(time.Second * 60):
log.Fatalf("graceful shutdown timed out")
os.Exit(1)
}
}()
d.Shutdown()
log.Println("Shutdown completed, exiting.")
}