Add git functions & improve grafana functions
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2d08f75545
commit
0fb6e0b6e9
7 changed files with 579 additions and 16 deletions
28
pkg/git/signer.go
Normal file
28
pkg/git/signer.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package git
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/ProtonMail/go-crypto/openpgp"
|
||||
"github.com/ProtonMail/go-crypto/openpgp/armor"
|
||||
)
|
||||
|
||||
func getSigner(keyFile string) (*openpgp.Entity, error) {
|
||||
file, err := os.Open(keyFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
block, err := armor.Decode(file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
entityList, err := openpgp.ReadKeyRing(block.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return entityList[0], nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue