I have a mini gin micro service that need https. But sometimes, my certfile is renewed with certbot but I don't know when, and my gin micro service is still using the old cert.
func Run() {
fmt.Println("begin")
r := gin.Default()
r.Use(cors.Default())
r.POST("getLieu/", getAdr)
r.GET("lucky/", Lucky)
r.RunTLS((":8083"),"/etc/letsencrypt/live/toto.fr/fullchain.pem","/etc/letsencrypt/live/toto.fr/privkey.pem") // listen and serve on 0.0.0.0:8080
}
How can i tell my gin program to check if the cert have changed or not?
You restart it periodically.
Analogue example, nginx sits in front of your gin program:
certbot renew
cronjob or systemd timer is ranThe same happens with your gin program. You restart the gin program (/service) every week.
Extra points: graceful shutdown