mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-25 14:50:33 +00:00
Fix agent auth (#1952)
if no global agent secret set, disable agent registration via it
This commit is contained in:
@@ -36,7 +36,6 @@ func Config(cli *cli.Context) gin.HandlerFunc {
|
||||
func setupConfig(c *cli.Context) *model.Settings {
|
||||
return &model.Settings{
|
||||
Open: c.Bool("open"),
|
||||
Secret: c.String("agent-secret"),
|
||||
Admins: sliceToMap2(c.StringSlice("admin")),
|
||||
Orgs: sliceToMap2(c.StringSlice("orgs")),
|
||||
OwnersWhitelist: sliceToMap2(c.StringSlice("repo-owners")),
|
||||
@@ -54,3 +53,9 @@ func sliceToMap2(s []string) map[string]bool {
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// GetConfig returns the config from the Context
|
||||
func GetConfig(c *gin.Context) *model.Settings {
|
||||
v := c.MustGet(configKey)
|
||||
return v.(*model.Settings)
|
||||
}
|
||||
|
Reference in New Issue
Block a user