-
Notifications
You must be signed in to change notification settings - Fork 73
/
gravitee-server.go
63 lines (57 loc) · 1.13 KB
/
gravitee-server.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 (
"log"
"os"
"github.com/spring2go/gravitee/cmd"
"github.com/urfave/cli"
)
var (
cliApp *cli.App
configFile string
)
func init() {
// Initialize a CLI app
cliApp = cli.NewApp()
cliApp.Name = "gravitee-oauth2-server"
cliApp.Usage = "Gravitee OAuth 2.0 Server"
cliApp.Author = "Richard Knop & BoBo"
cliApp.Email = "[email protected]"
cliApp.Version = "0.5.0"
cliApp.Flags = []cli.Flag{
cli.StringFlag{
Name: "configFile",
Value: "config.yml",
Destination: &configFile,
},
}
}
func main() {
// Set the CLI app commands
cliApp.Commands = []cli.Command{
{
Name: "migrate",
Usage: "run migrations",
Action: func(c *cli.Context) error {
return cmd.Migrate(configFile)
},
},
{
Name: "loaddata",
Usage: "load data from fixture",
Action: func(c *cli.Context) error {
return cmd.LoadData(c.Args(), configFile)
},
},
{
Name: "runserver",
Usage: "run web server",
Action: func(c *cli.Context) error {
return cmd.RunServer(configFile)
},
},
}
// Run the CLI app
if err := cliApp.Run(os.Args); err != nil {
log.Fatal(err)
}
}