Merge pull request #28 from rowbawts/dev

Fix port on listening message
This commit is contained in:
Sebastian Cabrera 2023-08-28 21:40:37 -04:00 committed by GitHub
commit 0026b57e23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

1
bot/.gitignore vendored
View file

@ -1 +0,0 @@
*.pem

View file

@ -7,12 +7,14 @@ import (
"golang.org/x/net/context"
"log"
"net/http"
"os"
"strconv"
"strings"
)
// Wrap the shared transport for use with the integration ID and authenticating with installation ID.
var itr, _ = ghinstallation.NewKeyFromFile(http.DefaultTransport, 381312, 41105280, "theopenestsource.2023-08-26.private-key.pem")
var privateKey = os.Getenv("privateKey")
var itr, _ = ghinstallation.NewKeyFromFile(http.DefaultTransport, 381312, 41105280, privateKey)
// Use installation transport with client.
var client = github.NewClient(&http.Client{Transport: itr})
@ -20,10 +22,17 @@ var ctx = context.Background()
func initGitHubClient() {
log.Println("Initializing......")
if privateKey != "" {
log.Println(privateKey)
} else {
log.Println("Private key not found!")
os.Exit(0)
}
}
func listenForWebhook() {
log.Println("Listening on :3333......")
log.Println("Listening on :433......")
http.HandleFunc("/", webHandle)
http.HandleFunc("/webhook", webhookHandler)