From b28529ca80a3f6caed0009a9b7862a645cf9e693 Mon Sep 17 00:00:00 2001 From: okseby Date: Mon, 28 Aug 2023 21:42:52 -0400 Subject: [PATCH 1/3] Stop printing private key to console --- bot/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/utils.go b/bot/utils.go index 74b617c..a8630c6 100644 --- a/bot/utils.go +++ b/bot/utils.go @@ -24,7 +24,7 @@ func initGitHubClient() { log.Println("Initializing......") if privateKey != "" { - log.Println(privateKey) + log.Println("Private key loaded from env") } else { log.Println("Private key not found!") os.Exit(0) From 77b8be9968526d4b36e63e6b6ba3851e0805f273 Mon Sep 17 00:00:00 2001 From: okseby Date: Mon, 28 Aug 2023 21:56:23 -0400 Subject: [PATCH 2/3] Read private key as byte array --- bot/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/utils.go b/bot/utils.go index a8630c6..ae70979 100644 --- a/bot/utils.go +++ b/bot/utils.go @@ -14,7 +14,7 @@ import ( // Wrap the shared transport for use with the integration ID and authenticating with installation ID. var privateKey = os.Getenv("privateKey") -var itr, _ = ghinstallation.NewKeyFromFile(http.DefaultTransport, 381312, 41105280, privateKey) +var itr, _ = ghinstallation.New(http.DefaultTransport, 381312, 41105280, []byte(privateKey)) // Use installation transport with client. var client = github.NewClient(&http.Client{Transport: itr}) From b67df94c1ed9757d53113adcd42cc063840252df Mon Sep 17 00:00:00 2001 From: okseby Date: Mon, 28 Aug 2023 22:08:32 -0400 Subject: [PATCH 3/3] Add exclamation point for consistency --- bot/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/utils.go b/bot/utils.go index ae70979..66329eb 100644 --- a/bot/utils.go +++ b/bot/utils.go @@ -24,7 +24,7 @@ func initGitHubClient() { log.Println("Initializing......") if privateKey != "" { - log.Println("Private key loaded from env") + log.Println("Private key loaded from env!") } else { log.Println("Private key not found!") os.Exit(0)