1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-12-01 22:51:45 +02:00

added an option to enable GCP healthcheck endpoints

This commit is contained in:
timothy-spencer
2019-03-20 14:29:44 -07:00
parent ca89bb833d
commit 3476daf322
3 changed files with 31 additions and 5 deletions

10
main.go
View File

@@ -5,6 +5,7 @@ import (
"fmt"
"log"
"math/rand"
"net/http"
"os"
"runtime"
"strings"
@@ -92,6 +93,7 @@ func main() {
flagSet.String("acr-values", "http://idmanagement.gov/ns/assurance/loa/1", "acr values string: optional, used by login.gov")
flagSet.String("jwt-key", "", "private key used to sign JWT: required by login.gov")
flagSet.String("pubjwk-url", "", "JWK pubkey access endpoint: required by login.gov")
flagSet.Bool("gcp-healthchecks", false, "Enable GCP healthcheck endpoints")
flagSet.Parse(os.Args[1:])
@@ -139,8 +141,14 @@ func main() {
rand.Seed(time.Now().UnixNano())
var myhandler http.Handler
if opts.GCPHealthChecks {
myhandler = gcpHealthcheck(LoggingHandler(os.Stdout, oauthproxy, opts.RequestLogging, opts.RequestLoggingFormat))
} else {
myhandler = LoggingHandler(os.Stdout, oauthproxy, opts.RequestLogging, opts.RequestLoggingFormat)
}
s := &Server{
Handler: LoggingHandler(os.Stdout, oauthproxy, opts.RequestLogging, opts.RequestLoggingFormat),
Handler: myhandler,
Opts: opts,
}
s.ListenAndServe()