Add git functions & improve grafana functions
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Tom Neuber 2024-02-16 21:56:27 +01:00
parent 2d08f75545
commit 0fb6e0b6e9
Signed by: tom
GPG key ID: F17EFE4272D89FF6
7 changed files with 579 additions and 16 deletions

28
pkg/git/signer.go Normal file
View 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
}