MCPcopy Create free account
hub / github.com/bytesizedhosting/bcd / NewAutoHttpsServer

Function NewAutoHttpsServer

cmd/bcd-proxy/ssl_server.go:32–52  ·  view source on GitHub ↗
(cachePath string, email string, handler http.Handler)

Source from the content-addressed store, hash-verified

30}
31
32func NewAutoHttpsServer(cachePath string, email string, handler http.Handler) *http.Server {
33 if cachePath == "" {
34 cachePath = defaultCachePath()
35 }
36 log.Infoln("Setting up auto-manager with cache at", cachePath)
37
38 m := autocert.Manager{
39 Prompt: autocert.AcceptTOS,
40 HostPolicy: noByshioHP,
41 Cache: autocert.DirCache(cachePath),
42 Email: email,
43 }
44
45 s := &http.Server{
46 Addr: ":https",
47 TLSConfig: &tls.Config{GetCertificate: m.GetCertificate},
48 Handler: handler,
49 }
50
51 return s
52}

Callers 1

mainFunction · 0.85

Calls 1

defaultCachePathFunction · 0.85

Tested by

no test coverage detected