mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-30 06:38:37 -04:00 
			
		
		
		
	Update github.com/lafriks/xormstore and tidy up mod.go (#8020)
This commit is contained in:
		
				
					committed by
					
						 Antoine GIRARD
						Antoine GIRARD
					
				
			
			
				
	
			
			
			
						parent
						
							dd3ba9bb6b
						
					
				
				
					commit
					cedb285e25
				
			
							
								
								
									
										14
									
								
								vendor/github.com/gorilla/sessions/doc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/gorilla/sessions/doc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -26,7 +26,11 @@ Let's start with an example that shows the sessions API in a nutshell: | ||||
| 		"github.com/gorilla/sessions" | ||||
| 	) | ||||
|  | ||||
| 	var store = sessions.NewCookieStore([]byte("something-very-secret")) | ||||
| 	// Note: Don't store your key in your source code. Pass it via an | ||||
| 	// environmental variable, or flag (or both), and don't accidentally commit it | ||||
| 	// alongside your code. Ensure your key is sufficiently random - i.e. use Go's | ||||
| 	// crypto/rand or securecookie.GenerateRandomKey(32) and persist the result. | ||||
| 	var store = sessions.NewCookieStore(os.Getenv("SESSION_KEY")) | ||||
|  | ||||
| 	func MyHandler(w http.ResponseWriter, r *http.Request) { | ||||
| 		// Get a session. Get() always returns a session, even if empty. | ||||
| @@ -55,14 +59,6 @@ session.Save(r, w), and either display an error message or otherwise handle it. | ||||
| Save must be called before writing to the response, otherwise the session | ||||
| cookie will not be sent to the client. | ||||
|  | ||||
| Important Note: If you aren't using gorilla/mux, you need to wrap your handlers | ||||
| with context.ClearHandler as or else you will leak memory! An easy way to do this | ||||
| is to wrap the top-level mux when calling http.ListenAndServe: | ||||
|  | ||||
|     http.ListenAndServe(":8080", context.ClearHandler(http.DefaultServeMux)) | ||||
|  | ||||
| The ClearHandler function is provided by the gorilla/context package. | ||||
|  | ||||
| That's all you need to know for the basic usage. Let's take a look at other | ||||
| options, starting with flash messages. | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user