cmd/serve: minor code improve for PR #4078

This commit is contained in:
Unknwon
2017-02-01 21:28:43 -05:00
parent 0081c6911d
commit 2bb1de1805
4 changed files with 23 additions and 31 deletions

View File

@@ -88,6 +88,11 @@ func (key *PublicKey) AuthorizedString() string {
return fmt.Sprintf(_TPL_PUBLICK_KEY, setting.AppPath, key.ID, setting.CustomConf, key.Content)
}
// IsDeployKey returns true if the public key is used as deploy key.
func (key *PublicKey) IsDeployKey() bool {
return key.Type == KEY_TYPE_DEPLOY
}
func extractTypeFromBase64Key(key string) (string, error) {
b, err := base64.StdEncoding.DecodeString(key)
if err != nil || len(b) < 4 {