32 lines
533 B
Go
32 lines
533 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
"net/http"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
"github.com/gin-gonic/autotls"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func main() {
|
|
// Create context that listens for the interrupt signal from the OS.
|
|
ctx, stop := signal.NotifyContext(
|
|
context.Background(),
|
|
syscall.SIGINT,
|
|
syscall.SIGTERM,
|
|
)
|
|
defer stop()
|
|
|
|
r := gin.Default()
|
|
|
|
// Ping handler
|
|
r.GET("/ping", func(c *gin.Context) {
|
|
c.String(http.StatusOK, "pong")
|
|
})
|
|
|
|
log.Fatal(autotls.RunWithContext(ctx, r, "example1.com", "example2.com"))
|
|
}
|