mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-30 18:17:55 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			644 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			644 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright (c) HashiCorp, Inc.
 | |
| // SPDX-License-Identifier: MPL-2.0
 | |
| 
 | |
| package config
 | |
| 
 | |
| import (
 | |
| 	"github.com/hashicorp/vault/command/token"
 | |
| )
 | |
| 
 | |
| // DefaultTokenHelper returns the token helper that is configured for Vault.
 | |
| // This helper should only be used for non-server CLI commands.
 | |
| func DefaultTokenHelper() (token.TokenHelper, error) {
 | |
| 	config, err := LoadConfig("")
 | |
| 	if err != nil {
 | |
| 		return nil, err
 | |
| 	}
 | |
| 
 | |
| 	path := config.TokenHelper
 | |
| 	if path == "" {
 | |
| 		return token.NewInternalTokenHelper()
 | |
| 	}
 | |
| 
 | |
| 	path, err = token.ExternalTokenHelperPath(path)
 | |
| 	if err != nil {
 | |
| 		return nil, err
 | |
| 	}
 | |
| 	return &token.ExternalTokenHelper{BinaryPath: path}, nil
 | |
| }
 | 
