Skip to content

Commit 39fb59e

Browse files
fail if both private key and key path are provided.
added a comment to clarify how the private key should be encoded
1 parent 27ed3bd commit 39fb59e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

internal/controller/config.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ type Config struct {
2020
PhysicalEnvironment string
2121
Cluster string
2222
//nolint:gosec
23-
APIToken string
24-
BaseURL string
25-
GHAppID string
26-
GHInstallID string
23+
APIToken string
24+
BaseURL string
25+
GHAppID string
26+
GHInstallID string
27+
// GHAppPrivateKey must be the PEM Encoding of the
28+
// private key
2729
GHAppPrivateKey []byte
2830
GHAppPrivateKeyPath string
2931
Organization string

pkg/deploymentrecord/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ func WithAPIToken(token string) ClientOption {
107107
// If an API token is also set, the GitHub App will take precedence.
108108
func WithGHApp(id, installID string, pkBytes []byte, pkPath string) ClientOption {
109109
return func(c *Client) {
110+
if len(pkBytes) > 0 && pkPath != "" {
111+
panic("both GitHub App private key and private key path are set")
112+
}
113+
110114
pid, err := strconv.Atoi(id)
111115
if err != nil {
112116
panic(err)

0 commit comments

Comments
 (0)