@@ -20,8 +20,7 @@ import (
20
20
)
21
21
22
22
var (
23
- echoInstance * echo.Echo
24
- jwtPrivateKeyPath string
23
+ echoInstance * echo.Echo
25
24
)
26
25
27
26
const (
@@ -40,7 +39,7 @@ func init() {
40
39
flag .StringVar (& gaia .Cfg .ListenPort , "port" , "8080" , "Listen port for gaia" )
41
40
flag .StringVar (& gaia .Cfg .HomePath , "homepath" , "" , "Path to the gaia home folder" )
42
41
flag .StringVar (& gaia .Cfg .Worker , "worker" , "2" , "Number of worker gaia will use to execute pipelines in parallel" )
43
- flag .StringVar (& jwtPrivateKeyPath , "jwtPrivateKeyPath" , "" , "A RSA private key used to sign JWT tokens" )
42
+ flag .StringVar (& gaia . Cfg . JwtPrivateKeyPath , "jwtPrivateKeyPath" , "" , "A RSA private key used to sign JWT tokens" )
44
43
flag .BoolVar (& gaia .Cfg .DevMode , "dev" , false , "If true, gaia will be started in development mode. Don't use this in production!" )
45
44
flag .BoolVar (& gaia .Cfg .VersionSwitch , "version" , false , "If true, will print the version and immediately exit" )
46
45
@@ -67,7 +66,7 @@ func main() {
67
66
68
67
var jwtKey interface {}
69
68
// Check JWT key is set
70
- if jwtPrivateKeyPath == "" {
69
+ if gaia . Cfg . JwtPrivateKeyPath == "" {
71
70
gaia .Cfg .Logger .Warn ("using auto-generated key to sign jwt tokens, do not use in production" )
72
71
jwtKey = make ([]byte , 64 )
73
72
_ , err := rand .Read (jwtKey .([]byte ))
@@ -76,7 +75,7 @@ func main() {
76
75
os .Exit (1 )
77
76
}
78
77
} else {
79
- keyData , err := ioutil .ReadFile (jwtPrivateKeyPath )
78
+ keyData , err := ioutil .ReadFile (gaia . Cfg . JwtPrivateKeyPath )
80
79
if err != nil {
81
80
gaia .Cfg .Logger .Error ("could not read jwt key file" , "error" , err .Error ())
82
81
os .Exit (1 )
0 commit comments