-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (25 loc) · 770 Bytes
/
main.go
File metadata and controls
34 lines (25 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"crypto/tls"
"log"
"net/http"
env "github.com/caarlos0/env/v6"
"github.com/le-garff-yoann/oauth2-proxy-nexus3/reverseproxy"
)
var cfg = config{}
func main() {
if err := env.Parse(&cfg); err != nil {
log.Fatalf("Failed to parse the configuration: %s", err)
}
var (
reverseProxy = reverseproxy.New(
cfg.NexusURL, cfg.AuthproviderURL, cfg.NexusURL,
cfg.AuthproviderAccessTokenHeader,
cfg.NexusAdminUser, cfg.NexusAdminPassword, cfg.NexusRutHeader,
)
server = http.Server{Addr: cfg.ListenOn, Handler: reverseProxy.Router}
)
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: cfg.SSLInsecureSkipVerify}
log.Println("Starting the proxy")
log.Panicln(server.ListenAndServe())
}