-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (34 loc) · 834 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
package main
import (
"context"
"log"
"os"
"github.com/ameykpatil/chatbot/command"
"github.com/ameykpatil/chatbot/config"
"github.com/urfave/cli"
)
func main() {
app := cli.NewApp()
app.Name = "chatbot"
app.Usage = "The service to serve the replies for the messages based on intent"
app.UsageText = "chatbot"
// Init envConfig
envConfig, err := config.LoadEnv()
if err != nil {
log.Fatalf("envConfig could not be loaded, error : %s", err)
}
baseCommand := command.NewBaseCommand(context.TODO(), envConfig)
httpCommand := command.NewHTTPCommand(baseCommand)
app.Commands = []cli.Command{
{
Name: "http",
Usage: "Start REST API service",
Action: httpCommand.Run,
},
// Add more commands such as consumer or some periodic job
}
err = app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}