-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.go
47 lines (43 loc) · 866 Bytes
/
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
package main
import (
"log"
"os"
"github.com/ecojuntak/hashtag-api/cmds"
"github.com/ecojuntak/hashtag-api/data"
"github.com/urfave/cli"
)
func main() {
cliApp := cli.NewApp()
cliApp.Name = "hashtag-api"
cliApp.Version = "1.0.0"
cliApp.Commands = []cli.Command{
{
Name: "migrate",
Description: "Run database migration",
Action: func(c *cli.Context) error {
err := data.RunMigration()
if err != nil {
log.Println(err)
}
return err
},
},
{
Name: "start-amqp",
Description: "Start listening to RabbitMQ Server",
Action: func(c *cli.Context) error {
cmds.StartRabbitMQ()
return nil
},
},
{
Name: "start-rest",
Description: "Start listening to REST API",
Action: func(c *cli.Context) error {
cmds.StartREST()
return nil
},
},
}
cliApp.Run(os.Args)
}