-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
82 lines (79 loc) · 1.9 KB
/
main.go
File metadata and controls
82 lines (79 loc) · 1.9 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package main
import (
"os"
"github.com/dictyBase/authserver/commands"
"github.com/dictyBase/authserver/validate"
"gopkg.in/urfave/cli.v1"
)
func main() {
app := cli.NewApp()
app.Name = "authserver"
app.Usage = "oauth server that provides endpoints for managing authentication"
app.Version = "4.0.0"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "log-file,l",
Usage: "Name of the log file(optional), default goes to stderr",
},
cli.StringFlag{
Name: "log-format",
Usage: "Format of the log output,could be either of text or json, default is json",
},
}
app.Commands = []cli.Command{
{
Name: "run",
Usage: "runs the auth server",
Action: commands.RunServer,
Before: validate.ValidateRunArgs,
Flags: []cli.Flag{
cli.StringFlag{
Name: "config, c",
Usage: "Config file(required)",
EnvVar: "OAUTH_CONFIG",
},
cli.StringFlag{
Name: "pkey, public-key",
Usage: "public key file for verifying jwt",
EnvVar: "JWT_PUBLIC_KEY",
},
cli.StringFlag{
Name: "private-key, prkey",
Usage: "private key file for signning jwt",
EnvVar: "JWT_PRIVATE_KEY",
},
cli.IntFlag{
Name: "port, p",
Usage: "server port",
Value: 9999,
},
cli.StringFlag{
Name: "messaging-host",
EnvVar: "NATS_SERVICE_HOST",
Usage: "host address for messaging server",
},
cli.StringFlag{
Name: "messaging-port",
EnvVar: "NATS_SERVICE_PORT",
Usage: "port for messaging server",
},
},
},
{
Name: "generate-keys",
Usage: "generate rsa key pairs(public and private keys) in pem format",
Action: commands.GenerateKeys,
Flags: []cli.Flag{
cli.StringFlag{
Name: "private, pr",
Usage: "output file name for private key",
},
cli.StringFlag{
Name: "public, pub",
Usage: "output file name for public key",
},
},
},
}
app.Run(os.Args)
}