|
|
@ -60,11 +60,6 @@ var ( |
|
|
|
Name: "admin", |
|
|
|
Name: "admin", |
|
|
|
Usage: "User is an admin", |
|
|
|
Usage: "User is an admin", |
|
|
|
}, |
|
|
|
}, |
|
|
|
cli.StringFlag{ |
|
|
|
|
|
|
|
Name: "config, c", |
|
|
|
|
|
|
|
Value: "custom/conf/app.ini", |
|
|
|
|
|
|
|
Usage: "Custom configuration file path", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
cli.BoolFlag{ |
|
|
|
cli.BoolFlag{ |
|
|
|
Name: "random-password", |
|
|
|
Name: "random-password", |
|
|
|
Usage: "Generate a random password for the user", |
|
|
|
Usage: "Generate a random password for the user", |
|
|
@ -96,11 +91,6 @@ var ( |
|
|
|
Value: "", |
|
|
|
Value: "", |
|
|
|
Usage: "New password to set for user", |
|
|
|
Usage: "New password to set for user", |
|
|
|
}, |
|
|
|
}, |
|
|
|
cli.StringFlag{ |
|
|
|
|
|
|
|
Name: "config, c", |
|
|
|
|
|
|
|
Value: "custom/conf/app.ini", |
|
|
|
|
|
|
|
Usage: "Custom configuration file path", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -123,26 +113,12 @@ var ( |
|
|
|
Name: "hooks", |
|
|
|
Name: "hooks", |
|
|
|
Usage: "Regenerate git-hooks", |
|
|
|
Usage: "Regenerate git-hooks", |
|
|
|
Action: runRegenerateHooks, |
|
|
|
Action: runRegenerateHooks, |
|
|
|
Flags: []cli.Flag{ |
|
|
|
|
|
|
|
cli.StringFlag{ |
|
|
|
|
|
|
|
Name: "config, c", |
|
|
|
|
|
|
|
Value: "custom/conf/app.ini", |
|
|
|
|
|
|
|
Usage: "Custom configuration file path", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
microcmdRegenKeys = cli.Command{ |
|
|
|
microcmdRegenKeys = cli.Command{ |
|
|
|
Name: "keys", |
|
|
|
Name: "keys", |
|
|
|
Usage: "Regenerate authorized_keys file", |
|
|
|
Usage: "Regenerate authorized_keys file", |
|
|
|
Action: runRegenerateKeys, |
|
|
|
Action: runRegenerateKeys, |
|
|
|
Flags: []cli.Flag{ |
|
|
|
|
|
|
|
cli.StringFlag{ |
|
|
|
|
|
|
|
Name: "config, c", |
|
|
|
|
|
|
|
Value: "custom/conf/app.ini", |
|
|
|
|
|
|
|
Usage: "Custom configuration file path", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
subcmdAuth = cli.Command{ |
|
|
|
subcmdAuth = cli.Command{ |
|
|
@ -160,13 +136,6 @@ var ( |
|
|
|
Name: "list", |
|
|
|
Name: "list", |
|
|
|
Usage: "List auth sources", |
|
|
|
Usage: "List auth sources", |
|
|
|
Action: runListAuth, |
|
|
|
Action: runListAuth, |
|
|
|
Flags: []cli.Flag{ |
|
|
|
|
|
|
|
cli.StringFlag{ |
|
|
|
|
|
|
|
Name: "config, c", |
|
|
|
|
|
|
|
Value: "custom/conf/app.ini", |
|
|
|
|
|
|
|
Usage: "Custom configuration file path", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
idFlag = cli.Int64Flag{ |
|
|
|
idFlag = cli.Int64Flag{ |
|
|
@ -178,22 +147,9 @@ var ( |
|
|
|
Name: "delete", |
|
|
|
Name: "delete", |
|
|
|
Usage: "Delete specific auth source", |
|
|
|
Usage: "Delete specific auth source", |
|
|
|
Action: runDeleteAuth, |
|
|
|
Action: runDeleteAuth, |
|
|
|
Flags: []cli.Flag{ |
|
|
|
|
|
|
|
cli.StringFlag{ |
|
|
|
|
|
|
|
Name: "config, c", |
|
|
|
|
|
|
|
Value: "custom/conf/app.ini", |
|
|
|
|
|
|
|
Usage: "Custom configuration file path", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
idFlag, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
oauthCLIFlags = []cli.Flag{ |
|
|
|
oauthCLIFlags = []cli.Flag{ |
|
|
|
cli.StringFlag{ |
|
|
|
|
|
|
|
Name: "config, c", |
|
|
|
|
|
|
|
Value: "custom/conf/app.ini", |
|
|
|
|
|
|
|
Usage: "Custom configuration file path", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
cli.StringFlag{ |
|
|
|
cli.StringFlag{ |
|
|
|
Name: "name", |
|
|
|
Name: "name", |
|
|
|
Value: "", |
|
|
|
Value: "", |
|
|
@ -266,10 +222,6 @@ func runChangePassword(c *cli.Context) error { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if c.IsSet("config") { |
|
|
|
|
|
|
|
setting.CustomConf = c.String("config") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err := initDB(); err != nil { |
|
|
|
if err := initDB(); err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
@ -331,10 +283,6 @@ func runCreateUser(c *cli.Context) error { |
|
|
|
return errors.New("must set either password or random-password flag") |
|
|
|
return errors.New("must set either password or random-password flag") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if c.IsSet("config") { |
|
|
|
|
|
|
|
setting.CustomConf = c.String("config") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err := initDB(); err != nil { |
|
|
|
if err := initDB(); err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
@ -430,10 +378,6 @@ func getReleaseCount(id int64) (int64, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func runRegenerateHooks(c *cli.Context) error { |
|
|
|
func runRegenerateHooks(c *cli.Context) error { |
|
|
|
if c.IsSet("config") { |
|
|
|
|
|
|
|
setting.CustomConf = c.String("config") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err := initDB(); err != nil { |
|
|
|
if err := initDB(); err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
@ -441,10 +385,6 @@ func runRegenerateHooks(c *cli.Context) error { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func runRegenerateKeys(c *cli.Context) error { |
|
|
|
func runRegenerateKeys(c *cli.Context) error { |
|
|
|
if c.IsSet("config") { |
|
|
|
|
|
|
|
setting.CustomConf = c.String("config") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err := initDB(); err != nil { |
|
|
|
if err := initDB(); err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
@ -473,10 +413,6 @@ func parseOAuth2Config(c *cli.Context) *models.OAuth2Config { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func runAddOauth(c *cli.Context) error { |
|
|
|
func runAddOauth(c *cli.Context) error { |
|
|
|
if c.IsSet("config") { |
|
|
|
|
|
|
|
setting.CustomConf = c.String("config") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err := initDB(); err != nil { |
|
|
|
if err := initDB(); err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
@ -490,10 +426,6 @@ func runAddOauth(c *cli.Context) error { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func runUpdateOauth(c *cli.Context) error { |
|
|
|
func runUpdateOauth(c *cli.Context) error { |
|
|
|
if c.IsSet("config") { |
|
|
|
|
|
|
|
setting.CustomConf = c.String("config") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if !c.IsSet("id") { |
|
|
|
if !c.IsSet("id") { |
|
|
|
return fmt.Errorf("--id flag is missing") |
|
|
|
return fmt.Errorf("--id flag is missing") |
|
|
|
} |
|
|
|
} |
|
|
@ -561,10 +493,6 @@ func runUpdateOauth(c *cli.Context) error { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func runListAuth(c *cli.Context) error { |
|
|
|
func runListAuth(c *cli.Context) error { |
|
|
|
if c.IsSet("config") { |
|
|
|
|
|
|
|
setting.CustomConf = c.String("config") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err := initDB(); err != nil { |
|
|
|
if err := initDB(); err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
@ -587,10 +515,6 @@ func runListAuth(c *cli.Context) error { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func runDeleteAuth(c *cli.Context) error { |
|
|
|
func runDeleteAuth(c *cli.Context) error { |
|
|
|
if c.IsSet("config") { |
|
|
|
|
|
|
|
setting.CustomConf = c.String("config") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if !c.IsSet("id") { |
|
|
|
if !c.IsSet("id") { |
|
|
|
return fmt.Errorf("--id flag is missing") |
|
|
|
return fmt.Errorf("--id flag is missing") |
|
|
|
} |
|
|
|
} |
|
|
|