mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 18:48:08 +00:00 
			
		
		
		
	![hashicorp-copywrite[bot]](/assets/img/avatar_default.png) 0b12cdcfd1
			
		
	
	0b12cdcfd1
	
	
	
		
			
			* Adding explicit MPL license for sub-package. This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Adding explicit MPL license for sub-package. This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Updating the license from MPL to Business Source License. Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl. * add missing license headers * Update copyright file headers to BUS-1.1 * Fix test that expected exact offset on hcl file --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Sarah Thompson <sthompson@hashicorp.com> Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
		
			
				
	
	
		
			58 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright (c) HashiCorp, Inc.
 | |
| // SPDX-License-Identifier: BUSL-1.1
 | |
| 
 | |
| package command
 | |
| 
 | |
| import (
 | |
| 	"github.com/hashicorp/vault/command/config"
 | |
| )
 | |
| 
 | |
| const (
 | |
| 	// DefaultConfigPath is the default path to the configuration file
 | |
| 	DefaultConfigPath = "~/.vault"
 | |
| 
 | |
| 	// ConfigPathEnv is the environment variable that can be used to
 | |
| 	// override where the Vault configuration is.
 | |
| 	ConfigPathEnv = "VAULT_CONFIG_PATH"
 | |
| )
 | |
| 
 | |
| // Config is the CLI configuration for Vault that can be specified via
 | |
| // a `$HOME/.vault` file which is HCL-formatted (therefore HCL or JSON).
 | |
| type DefaultConfig struct {
 | |
| 	// TokenHelper is the executable/command that is executed for storing
 | |
| 	// and retrieving the authentication token for the Vault CLI. If this
 | |
| 	// is not specified, then vault's internal token store will be used, which
 | |
| 	// stores the token on disk unencrypted.
 | |
| 	TokenHelper string `hcl:"token_helper"`
 | |
| }
 | |
| 
 | |
| // Config loads the configuration and returns it. If the configuration
 | |
| // is already loaded, it is returned.
 | |
| //
 | |
| // Config just calls into config.Config for backwards compatibility purposes.
 | |
| // Use config.Config instead.
 | |
| func Config() (*DefaultConfig, error) {
 | |
| 	conf, err := config.Config()
 | |
| 	return (*DefaultConfig)(conf), err
 | |
| }
 | |
| 
 | |
| // LoadConfig reads the configuration from the given path. If path is
 | |
| // empty, then the default path will be used, or the environment variable
 | |
| // if set.
 | |
| //
 | |
| // LoadConfig just calls into config.LoadConfig for backwards compatibility
 | |
| // purposes. Use config.LoadConfig instead.
 | |
| func LoadConfig(path string) (*DefaultConfig, error) {
 | |
| 	conf, err := config.LoadConfig(path)
 | |
| 	return (*DefaultConfig)(conf), err
 | |
| }
 | |
| 
 | |
| // ParseConfig parses the given configuration as a string.
 | |
| //
 | |
| // ParseConfig just calls into config.ParseConfig for backwards compatibility
 | |
| // purposes. Use config.ParseConfig instead.
 | |
| func ParseConfig(contents string) (*DefaultConfig, error) {
 | |
| 	conf, err := config.ParseConfig(contents)
 | |
| 	return (*DefaultConfig)(conf), err
 | |
| }
 |