Move host to a env variable and combine host/port to address var for HTTP server
This commit is contained in:
parent
7eee357aad
commit
6c288c4bf6
1 changed files with 5 additions and 1 deletions
|
@ -6,6 +6,7 @@ import (
|
||||||
"github.com/google/go-github/v54/github"
|
"github.com/google/go-github/v54/github"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"log"
|
"log"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -14,6 +15,7 @@ import (
|
||||||
|
|
||||||
// Wrap the shared transport for use with the integration ID and authenticating with installation ID.
|
// Wrap the shared transport for use with the integration ID and authenticating with installation ID.
|
||||||
var privateKey = os.Getenv("privateKey")
|
var privateKey = os.Getenv("privateKey")
|
||||||
|
var host = os.Getenv("host")
|
||||||
var port = os.Getenv("port")
|
var port = os.Getenv("port")
|
||||||
var itr, _ = ghinstallation.New(http.DefaultTransport, 381312, 41105280, []byte(privateKey))
|
var itr, _ = ghinstallation.New(http.DefaultTransport, 381312, 41105280, []byte(privateKey))
|
||||||
|
|
||||||
|
@ -45,7 +47,9 @@ func listenForWebhook() {
|
||||||
http.HandleFunc("/", webHandle)
|
http.HandleFunc("/", webHandle)
|
||||||
http.HandleFunc("/webhook", webhookHandler)
|
http.HandleFunc("/webhook", webhookHandler)
|
||||||
|
|
||||||
err := http.ListenAndServe(port, nil)
|
address := net.JoinHostPort(host, port)
|
||||||
|
|
||||||
|
err := http.ListenAndServe(address, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue