Documentation
¶
Overview ¶
Package configdir provides simple functions to manage the SecretHub configuration directory.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrCredentialNotFound is returned when a credential file does not exist but CredentialFile.Read() is called. ErrCredentialNotFound = errors.New("credential not found") )
Functions ¶
This section is empty.
Types ¶
type CredentialFile ¶
type CredentialFile struct {
// contains filtered or unexported fields
}
CredentialFile represents the file that contains the SecretHub API credential. By default, it's a file named "credential" in the configuration directory.
func (*CredentialFile) Exists ¶
func (f *CredentialFile) Exists() bool
Exists returns true when a file exists at the path this credential points to.
func (*CredentialFile) Path ¶
func (f *CredentialFile) Path() string
Path returns the path on the filesystem at which the credential file is located.
func (*CredentialFile) Read ¶
func (f *CredentialFile) Read() ([]byte, error)
Read reads from the filesystem and returns the contents of the credential file.
func (*CredentialFile) Source ¶
func (f *CredentialFile) Source() string
Source returns the path to the credential file.
func (*CredentialFile) Write ¶
func (f *CredentialFile) Write(data []byte) error
Write writes the given bytes to the credential file.
type Dir ¶
type Dir struct {
// contains filtered or unexported fields
}
Dir represents the configuration directory located at some path on the file system.
func Default ¶
Default is the default way to get the location of the SecretHub configuration directory, sourcing it from the environment variable SECRETHUB_CONFIG_DIR or falling back to the ~/.secrethub directory.
func (Dir) Credential ¶
func (c Dir) Credential() *CredentialFile
Credential returns the file that contains the SecretHub API credential.