mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-31 15:53:33 +00:00 
			
		
		
		
	- Certificate renewal is just a re-request as it's forced already - Rejig the routes for readability - Added Server Side Events so that the UI would invalidate the cache when changes happen on the backend, such as certs being provided or failing - Added a SSE Token, which has the same shelf life as normal token but can't be used interchangeably. The reason for this is, the SSE endpoint needs a token for auth as a Query param, so it would be stored in log files. If someone where to get a hold of that, it's pretty useless as it can't be used to change anything, only to listen for events until it expires - Added test endpoint for SSE testing only availabe in debug mode
		
			
				
	
	
		
			31 lines
		
	
	
		
			517 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			517 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package api
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| 	"net/http"
 | |
| 	"time"
 | |
| 
 | |
| 	"npm/internal/logger"
 | |
| 	"npm/internal/serverevents"
 | |
| )
 | |
| 
 | |
| const httpPort = 3000
 | |
| 
 | |
| // StartServer creates a http server
 | |
| func StartServer() {
 | |
| 	logger.Info("Server starting on port %v", httpPort)
 | |
| 
 | |
| 	server := &http.Server{
 | |
| 		Addr:              fmt.Sprintf(":%v", httpPort),
 | |
| 		Handler:           NewRouter(),
 | |
| 		ReadHeaderTimeout: 3 * time.Second,
 | |
| 	}
 | |
| 
 | |
| 	defer serverevents.Shutdown()
 | |
| 
 | |
| 	err := server.ListenAndServe()
 | |
| 	if err != nil {
 | |
| 		logger.Error("HttpListenError", err)
 | |
| 	}
 | |
| }
 |