perf: move dynamic options reciever to server, enable Cache-Control HTTP header

This commit is contained in:
 Ilya Atamas
2019-04-23 17:59:18 +03:00
parent f821e794f8
commit 62e64e5154
9 changed files with 91 additions and 94 deletions

View File

@@ -18,6 +18,10 @@ func main() {
}),
},
HttpClient: &http.Client{},
}
proxy.Server(npmproxy.ServerOptions{
ListenAddress: "localhost:8080",
GetOptions: func() (npmproxy.Options, error) {
return npmproxy.Options{
DatabasePrefix: "ncp-",
@@ -25,9 +29,5 @@ func main() {
UpstreamAddress: "https://registry.npmjs.org",
}, nil
},
}
proxy.Server(npmproxy.ServerOptions{
ListenAddress: "localhost:8080",
}).ListenAndServe()
}