fix: remove hard code for cache.

This commit is contained in:
Bo-Yi Wu
2017-04-03 23:30:46 +08:00
parent 70d0a4c5ba
commit d17e0a31b8
2 changed files with 13 additions and 14 deletions

View File

@ -2,16 +2,19 @@ package main
import (
"github.com/gin-gonic/gin"
"golang.org/x/crypto/acme/autocert"
)
func main() {
r := gin.Default()
gin.AutoTLSManager.Cache = autocert.DirCache("/var/www/.cache")
// Ping handler
r.GET("/ping", func(c *gin.Context) {
c.String(200, "pong")
})
// Listen and Server in 0.0.0.0:443
r.RunAutoTLS(":443", "/var/www/.cache", "example.com")
r.RunAutoTLS("example.com")
}