mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 10:37:56 +00:00 
			
		
		
		
	backport of commit 063a782e2d (#19169)
				
					
				
			Co-authored-by: Christopher Swenson <christopher.swenson@hashicorp.com>
This commit is contained in:
		 hc-github-team-secure-vault-core
					hc-github-team-secure-vault-core
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							ef9f9c0f2d
						
					
				
				
					commit
					dbdbe9547c
				
			| @@ -61,11 +61,8 @@ func RootContext(ctx context.Context) context.Context { | ||||
| 	return ContextWithNamespace(ctx, RootNamespace) | ||||
| } | ||||
|  | ||||
| // This function caches the ns to avoid doing a .Value lookup over and over, | ||||
| // because it's called a *lot* in the request critical path. .Value is | ||||
| // concurrency-safe so uses some kind of locking/atomicity, but it should never | ||||
| // be read before first write, plus we don't believe this will be called from | ||||
| // different goroutines, so it should be safe. | ||||
| // FromContext retrieves the namespace from a context, or an error | ||||
| // if there is no namespace in the context. | ||||
| func FromContext(ctx context.Context) (*Namespace, error) { | ||||
| 	if ctx == nil { | ||||
| 		return nil, errors.New("context was nil") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user