-
Notifications
You must be signed in to change notification settings - Fork 43
/
main.go
52 lines (47 loc) · 1.1 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
package main
import (
"os"
"github.com/gojektech/proctor/proctord/logger"
"github.com/gojektech/proctor/proctord/server"
"github.com/gojektech/proctor/proctord/storage/postgres"
"github.com/urfave/cli"
)
func main() {
proctord := cli.NewApp()
proctord.Name = "proctord"
proctord.Usage = "Handle executing jobs and maintaining their configuration"
proctord.Version = "0.1.0"
proctord.Commands = []cli.Command{
{
Name: "migrate",
Description: "Run database migrations for proctord",
Action: func(c *cli.Context) {
err := postgres.Up()
if err != nil {
panic(err.Error())
}
logger.Info("Migration successful")
},
},
{
Name: "rollback",
Description: "Rollback database migrations by one step for proctord",
Action: func(c *cli.Context) {
err := postgres.DownOneStep()
if err != nil {
panic(err.Error())
}
logger.Info("Rollback successful")
},
},
{
Name: "start",
Aliases: []string{"s"},
Usage: "start server",
Action: func(c *cli.Context) error {
return server.Start()
},
},
}
proctord.Run(os.Args)
}