prepare for test deployment
embed static files remove hard tls requirement
This commit is contained in:
		
							parent
							
								
									64ff095002
								
							
						
					
					
						commit
						1b44d23dd6
					
				| @ -78,7 +78,11 @@ func main() { | ||||
| 
 | ||||
| 	logger.Info("Starting server", slog.Any("addr", *addr)) | ||||
| 
 | ||||
| 	if app.debug { | ||||
| 		err = srv.ListenAndServeTLS("./tls/cert.pem", "./tls/key.pem") | ||||
| 	} else { | ||||
| 		err = srv.ListenAndServe() | ||||
| 	} | ||||
| 	logger.Error(err.Error()) | ||||
| 	os.Exit(1) | ||||
| } | ||||
|  | ||||
| @ -3,13 +3,13 @@ package main | ||||
| import ( | ||||
| 	"net/http" | ||||
| 
 | ||||
| 	"git.32bit.cafe/32bitcafe/guestbook/ui" | ||||
| 	"github.com/justinas/alice" | ||||
| ) | ||||
| 
 | ||||
| func (app *application) routes() http.Handler { | ||||
| 	mux := http.NewServeMux() | ||||
| 	fileServer := http.FileServer(http.Dir("./ui/static")) | ||||
| 	mux.Handle("GET /static/", http.StripPrefix("/static", fileServer)) | ||||
| 	mux.Handle("GET /static/", http.FileServerFS(ui.Files)) | ||||
| 
 | ||||
| 	dynamic := alice.New(app.sessionManager.LoadAndSave, noSurf, app.authenticate) | ||||
| 	standard := alice.New(app.recoverPanic, app.logRequest, commonHeaders) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user