Skip to content

Commit

Permalink
quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
NorseGaud committed Oct 9, 2024
1 parent db3ad1c commit e580b14
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
36 changes: 28 additions & 8 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,34 @@ services:
# instead of defining a different one in the config.yml file for each runner.
# You can also set it to be the PEM contents, vs pointing to a file.
# - ANKLET_GLOBAL_PRIVATE_KEY=/Users/nathanpierce/veertuinc-anklet.2024-07-19.private-key.pem
# - |
# ANKLET_GLOBAL_PRIVATE_KEY=
# -----BEGIN RSA PRIVATE KEY-----
# MIIEpAIBAAKCAQEAyqZDXOEzV5gRocWAhH73chGjn4HBh1UCG2Du4v9JmcjfyYT3
# WvszUgAogTWqkSV4H1iL9NKfmKlA1GKngaXFCt5A1IbdR1KTkR0uisiqWO5Bzayr
# U5h+40ht0IjP3v+xQ8BWgjWbhHzPXbhcsmsTQvFfo0vAm+/UcwLKqpp0oUt11AVA
# . . .
# -----END RSA PRIVATE KEY-----
- |-
ANKLET_GLOBAL_PRIVATE_KEY=-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAyqZDXOEzV5gRocWAhH73chGjn4HBh1UCG2Du4v9JmcjfyYT3
WvszUgAogTWqkSV4H1iL9NKfmKlA1GKngaXFCt5A1IbdR1KTkR0uisiqWO5Bzayr
U5h+40ht0IjP3v+xQ8BWgjWbhHzPXbhcsmsTQvFfo0vAm+/UcwLKqpp0oUt11AVA
3gZeLtfWE2rRgsMKyX6Ix8I4dd1akJM6rNwBJy6uYQK8esJJ/45MHEjUal7Brpit
ICh2uPfX9O72xJjzqRA5FwGs/z8ommlEcxgwg8Yk0HdP2gFqfK/NB8vJellGiHmX
Sr7CHZw2W8e0DZi/uGG0baAWVfBujaGl96LYewIDAQABAoIBAAUJfvEnE9yghges
XhZtBX+LWrLTSdkwTr4Zebagu9abvJxIttFHHy5xnJAholy7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9AdgAUd/DBKjYuFfT0xsSWTeBaY0HVFA7e4JoeaIPe34P3l
kKovNpfH0s01kfgmThw+LtSGCEPoVL9dFJ7n/zJxUBkVvos2blr+JQ==
-----END RSA PRIVATE KEY-----
# AGGREGATOR ###################################################
# - ANKLET_METRICS_AGGREGATOR=true
# - ANKLET_METRICS_PORT=8081
Expand Down
1 change: 0 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ func worker(parentCtx context.Context, logger *slog.Logger, loadedConfig config.
pluginCtx = logging.AppendCtx(pluginCtx, slog.String("pluginName", plugin.Name))
pluginCtx = context.WithValue(pluginCtx, config.ContextKey("logger"), logger)

logger.InfoContext(pluginCtx, "plugin", slog.Any("plugin", plugin))
if !strings.Contains(plugin.Plugin, "_receiver") {
ankaCLI, err := anka.NewCLI(pluginCtx)
if err != nil {
Expand Down
11 changes: 10 additions & 1 deletion plugins/receivers/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"log/slog"
"net/http"
"os"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -144,7 +145,15 @@ func Run(
httpTransport := config.GetHttpTransportFromContext(pluginCtx)
var githubClient *github.Client
if ctxPlugin.PrivateKey != "" {
itr, err := ghinstallation.NewKeyFromFile(httpTransport, int64(ctxPlugin.AppID), int64(ctxPlugin.InstallationID), ctxPlugin.PrivateKey)
// support private key in a file or as text
var privateKey []byte
privateKeyData, err := os.ReadFile(ctxPlugin.PrivateKey)
if err == nil {
privateKey = privateKeyData
} else {
privateKey = []byte(ctxPlugin.PrivateKey)
}
itr, err := ghinstallation.New(httpTransport, int64(ctxPlugin.AppID), int64(ctxPlugin.InstallationID), privateKey)
if err != nil {
logger.ErrorContext(pluginCtx, "error creating github app installation token", "err", err)
return
Expand Down

0 comments on commit e580b14

Please sign in to comment.