diff options
| author | mo khan <mo@mokhan.ca> | 2022-04-14 10:14:09 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2022-04-14 10:14:09 -0600 |
| commit | a136d208d5d385af639f131651bd5c764aa2aa58 (patch) | |
| tree | d39c66a9a58b5ff357a3d34c0c03b791d250542c | |
| parent | 2cdcbf277d7c8ae5f8fa38588b6c2b96dcf0eabc (diff) | |
read host from env var
| -rw-r--r-- | src/oidc/main.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/oidc/main.go b/src/oidc/main.go index 3c9f057..cca89f5 100644 --- a/src/oidc/main.go +++ b/src/oidc/main.go @@ -8,6 +8,7 @@ import ( "io/ioutil" "log" "net/http" + "os" "text/template" "time" @@ -126,7 +127,11 @@ func handler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") data, _ := ioutil.ReadFile("openid-configuration.json") tmpl, _ := template.New("test").Parse(string(data)) - tmpl.Execute(w, struct{ Host string }{Host: "http://localhost:8282"}) + host, ok := os.LookupEnv("HOST") + if !ok { + host = "http://localhost:8282" + } + tmpl.Execute(w, struct{ Host string }{Host: host}) } else if r.URL.Path == "/userinfo" { w.WriteHeader(http.StatusNotImplemented) } else if r.URL.Path == "/.well-known/jwks.json" { |
