fix: get application details failed (#481)

Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
不羁
2019-06-20 16:23:24 +08:00
committed by GitHub
parent 836c011eeb
commit 4283814a68
9 changed files with 94 additions and 13 deletions

View File

@@ -28,6 +28,7 @@ type ServerRunOptions struct {
AdminPassword string
TokenExpireTime string
JWTSecret string
AuthRateLimit string
}
func NewServerRunOptions() *ServerRunOptions {
@@ -42,5 +43,6 @@ func (s *ServerRunOptions) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.AdminPassword, "admin-password", "passw0rd", "default administrator's password")
fs.StringVar(&s.TokenExpireTime, "token-expire-time", "2h", "token expire time,valid time units are \"ns\",\"us\",\"ms\",\"s\",\"m\",\"h\"")
fs.StringVar(&s.JWTSecret, "jwt-secret", "", "jwt secret")
fs.StringVar(&s.AuthRateLimit, "auth-rate-limit", "5/30m", "specifies the maximum number of authentication attempts permitted and time interval,valid time units are \"s\",\"m\",\"h\"")
s.GenericServerRunOptions.AddFlags(fs)
}

View File

@@ -75,7 +75,7 @@ func Run(s *options.ServerRunOptions) error {
initializeAdminJenkins()
initializeDevOpsDatabase()
err = iam.Init(s.AdminEmail, s.AdminPassword, expireTime)
err = iam.Init(s.AdminEmail, s.AdminPassword, expireTime, s.AuthRateLimit)
jwtutil.Setup(s.JWTSecret)
if err != nil {