aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/keys.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-12-17 01:49:07 +0000
committertechknowlogick <techknowlogick@gitea.io>2019-12-16 20:49:07 -0500
commitd1a49977b089afefc40172711d02eb795d2234de (patch)
treeb32acdcdf6b93a64f766e4fafeb70f75a881a1ab /cmd/keys.go
parent1707f59966df7fa4375235dbf43326d382eeaf97 (diff)
downloadgitea-d1a49977b089afefc40172711d02eb795d2234de.tar.gz
gitea-d1a49977b089afefc40172711d02eb795d2234de.zip
AuthorizedKeysCommand should not query db directly (#9371)
* AuthorizedKeysCommand should not query db directly * Update routers/private/internal.go * Fix import order
Diffstat (limited to 'cmd/keys.go')
-rw-r--r--cmd/keys.go10
1 files changed, 4 insertions, 6 deletions
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
}