Update healthcheck (#124)
This commit is contained in:
		
							parent
							
								
									2d9eeb08e8
								
							
						
					
					
						commit
						bf2b74fe84
					
				|  | @ -64,5 +64,5 @@ COPY --from=builder --chown=wgui:wgui /build/wg-ui /app | ||||||
| RUN chmod +x wg-ui | RUN chmod +x wg-ui | ||||||
| 
 | 
 | ||||||
| EXPOSE 5000/tcp | EXPOSE 5000/tcp | ||||||
| HEALTHCHECK CMD ["wget","--output-document=-","--quiet","--tries=1","http://127.0.0.1:5000/login"] | HEALTHCHECK CMD ["wget","--output-document=-","--quiet","--tries=1","http://127.0.0.1:5000/_health"] | ||||||
| ENTRYPOINT ["./wg-ui"] | ENTRYPOINT ["./wg-ui"] | ||||||
|  |  | ||||||
|  | @ -24,6 +24,13 @@ import ( | ||||||
| 	"github.com/ngoduykhanh/wireguard-ui/util" | 	"github.com/ngoduykhanh/wireguard-ui/util" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | // Health check handler
 | ||||||
|  | func Health() echo.HandlerFunc { | ||||||
|  | 	return func(c echo.Context) error { | ||||||
|  | 		return c.String(http.StatusOK, "ok") | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // LoginPage handler
 | // LoginPage handler
 | ||||||
| func LoginPage() echo.HandlerFunc { | func LoginPage() echo.HandlerFunc { | ||||||
| 	return func(c echo.Context) error { | 	return func(c echo.Context) error { | ||||||
|  |  | ||||||
							
								
								
									
										1
									
								
								main.go
								
								
								
								
							
							
						
						
									
										1
									
								
								main.go
								
								
								
								
							|  | @ -105,6 +105,7 @@ func main() { | ||||||
| 
 | 
 | ||||||
| 	sendmail := emailer.NewSendgridApiMail(util.SendgridApiKey, util.EmailFromName, util.EmailFrom) | 	sendmail := emailer.NewSendgridApiMail(util.SendgridApiKey, util.EmailFromName, util.EmailFrom) | ||||||
| 
 | 
 | ||||||
|  | 	app.GET("/_health", handler.Health()) | ||||||
| 	app.GET("/logout", handler.Logout(), handler.ValidSession) | 	app.GET("/logout", handler.Logout(), handler.ValidSession) | ||||||
| 	app.POST("/new-client", handler.NewClient(db), handler.ValidSession) | 	app.POST("/new-client", handler.NewClient(db), handler.ValidSession) | ||||||
| 	app.POST("/update-client", handler.UpdateClient(db), handler.ValidSession) | 	app.POST("/update-client", handler.UpdateClient(db), handler.ValidSession) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue