cloud-game/pkg/network/httpx/tls.go
sergystepanov fb8ee791df
Update the prod deployment script (#341)
Test new deployment workflow.
2021-08-24 21:54:32 +03:00

20 lines
376 B
Go

package httpx
import "golang.org/x/crypto/acme/autocert"
type TLS struct {
CertManager *autocert.Manager
}
func NewTLSConfig(host string) *TLS {
tls := TLS{
CertManager: &autocert.Manager{
Prompt: autocert.AcceptTOS,
Cache: autocert.DirCache("assets/cache"),
},
}
if host != "" {
tls.CertManager.HostPolicy = autocert.HostWhitelist(host)
}
return &tls
}