Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions cmd/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,27 @@ var (
Usage: "Synchronize repository releases with tags",
Action: runRepoSyncReleases,
}

subcmdRegenerate = cli.Command{
Name: "regenerate",
Usage: "Regenerate specific files",
Subcommands: []cli.Command{
microcmdRegenHooks,
microcmdRegenKeys,
},
}

microcmdRegenHooks = cli.Command{
Name: "hooks",
Usage: "Regenerate git-hooks",
Action: runRegenerateHooks,
}

microcmdRegenKeys = cli.Command{
Name: "keys",
Usage: "Regenerate authorized_keys file",
Action: runRegenerateKeys,
}
)

func runChangePassword(c *cli.Context) error {
Expand Down Expand Up @@ -195,3 +216,19 @@ func getReleaseCount(id int64) (int64, error) {
},
)
}

func runRegenerateHooks(c *cli.Context) error {
err := models.SyncRepositoryHooks()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just return models.SyncRepositoryHooks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @JonasFranzDEV I've made this change, and the other change you requested.

if err != nil {
return err
}
return nil
}

func runRegenerateKeys(c *cli.Context) error {
err := models.RewriteAllPublicKeys()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just return models.RewriteAllPublicKeys

if err != nil {
return err
}
return nil
}