diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2020-02-11 17:13:53 +0100 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2020-02-11 19:05:29 +0100 |
commit | 828ee14b4e903bbda9291bc9ee09ff98b66003c7 (patch) | |
tree | 171d4ba1766274087f2d29f233e90e59f5781225 /pkg | |
parent | ecaa22111ee8e34111080139e1e8a92b90e30158 (diff) |
[feat] metrics listen in separate port
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/config/config.go | 6 | ||||
-rw-r--r-- | pkg/web/handlers.go | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/pkg/config/config.go b/pkg/config/config.go index 76b4e4e..2e5eac7 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -30,6 +30,7 @@ type Opts struct { TlsCrt string TlsKey string Port string + MetricsPort string Auth string AuthSecret string ApiPath string @@ -87,8 +88,8 @@ func initializeFlags(opts *Opts) { flag.StringVar(&opts.TlsCrt, "tlsCrt", "", "Path to the cert file for TLS") flag.StringVar(&opts.TlsKey, "tlsKey", "", "Path to the key file for TLS") flag.StringVar(&opts.Port, "port", "", "Port where the server will listen (default: 8000)") - flag.StringVar(&opts.Auth, "auth", "", "Authentication module (ano, sip2)") - flag.StringVar(&opts.AuthSecret, "authSecret", "", "Authentication secret (optional)") + flag.StringVar(&opts.MetricsPort, "metricsPort", "", "Port where the metrics server will listen (default: 8001)") + flag.StringVar(&opts.Auth, "auth", "", "Authentication module (anon, sip2)") flag.StringVar(&opts.ApiPath, "apiPath", "", "Path to the API public files") flag.StringVar(&opts.ProviderCaPath, "providerCaCrt", "", "Path to the provider CA certificate") flag.Parse() @@ -98,6 +99,7 @@ func initializeFlags(opts *Opts) { FallbackToEnv(&opts.TlsCrt, "VPNWEB_TLSCRT", "") FallbackToEnv(&opts.TlsKey, "VPNWEB_TLSKEY", "") FallbackToEnv(&opts.Port, "VPNWEB_PORT", "8000") + FallbackToEnv(&opts.MetricsPort, "VPNWEB_METRICS_PORT", "8001") FallbackToEnv(&opts.Auth, "VPNWEB_AUTH", DefaultAuthenticationModule) FallbackToEnv(&opts.AuthSecret, "VPNWEB_AUTH_SECRET", "") FallbackToEnv(&opts.ApiPath, "VPNWEB_API_PATH", "/etc/leap/config/vpn") diff --git a/pkg/web/handlers.go b/pkg/web/handlers.go index 633ae95..9c4e91b 100644 --- a/pkg/web/handlers.go +++ b/pkg/web/handlers.go @@ -33,8 +33,8 @@ func (ch *CertHandler) CertResponder(w http.ResponseWriter, r *http.Request) { ch.Cainfo.CertWriter(w) } -func HttpFileHandler(route string, path string) { - http.HandleFunc(route, func(w http.ResponseWriter, r *http.Request) { +func HttpFileHandler(mux *http.ServeMux, route string, path string) { + mux.HandleFunc(route, func(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, path) }) } |