From d1a49977b089afefc40172711d02eb795d2234de Mon Sep 17 00:00:00 2001 From: zeripath Date: Tue, 17 Dec 2019 01:49:07 +0000 Subject: AuthorizedKeysCommand should not query db directly (#9371) * AuthorizedKeysCommand should not query db directly * Update routers/private/internal.go * Fix import order --- cmd/keys.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'cmd/keys.go') diff --git a/cmd/keys.go b/cmd/keys.go index 39153c7cb7..c0818fd2d2 100644 --- a/cmd/keys.go +++ b/cmd/keys.go @@ -9,7 +9,7 @@ import ( "fmt" "strings" - "code.gitea.io/gitea/models" + "code.gitea.io/gitea/modules/private" "github.com/urfave/cli" ) @@ -62,14 +62,12 @@ func runKeys(c *cli.Context) error { return errors.New("No key type and content provided") } - if err := initDBDisableConsole(true); err != nil { - return err - } + setup("keys.log") - publicKey, err := models.SearchPublicKeyByContent(content) + authorizedString, err := private.AuthorizedPublicKeyByContent(content) if err != nil { return err } - fmt.Println(publicKey.AuthorizedString()) + fmt.Println(strings.TrimSpace(authorizedString)) return nil } -- cgit v1.2.3