forked from surendratiwari3/jwt-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
executable file
·53 lines (43 loc) · 1.03 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 (
"flag"
"fmt"
"os"
"github.com/tiniyo/jwt-go/modules/log"
"github.com/tiniyo/jwt-go/router"
)
const (
DefaultConfFilePath = "config/config.toml"
)
var (
confFilePath string
help bool
)
func init() {
flag.StringVar(&confFilePath, "c", DefaultConfFilePath, "Config Path")
flag.StringVar(&confFilePath, "config", DefaultConfFilePath, "Config Path")
flag.BoolVar(&help, "h", false, "Show help message")
flag.BoolVar(&help, "help", false, "Show help message")
flag.Parse()
flag.Usage = usage
}
func usage() {
s := `jwt-go : a Application for JWT Generations and Verification
Usage: JWT [Options...]
Options:
-c, -config=<path> Config path of the site. Default is configs/config.toml.
Other options:
-h, -help Show help message.
`
fmt.Printf(s)
os.Exit(0)
}
func main() {
log.Info("Application for JWT Generations and Verification")
if help {
usage()
return
}
log.Debugf("run with conf:%s", confFilePath)
router.RunSubdomains(confFilePath)
}