Documentation ¶
Index ¶
- Constants
- func Decrypt(text []byte, key []byte) ([]byte, error)
- type EncryptedFile
- type File
- func (c *File) Delete(key string) error
- func (c *File) Get(key string, out interface{}) error
- func (c *File) GetAllKeys() ([]string, error)
- func (c *File) GetConnectionDetails(connectionName string) (*shared.ConnectionDetails, error)
- func (c *File) GetConnectionType(connectionName string) (connectionType string, err error)
- func (c *File) LoadConnection(connectionName string) (shared.ConnectionDetails, error)
- func (c *File) Set(key string, val interface{}) error
- type FileNotFoundError
- type KeyNotFoundError
Constants ¶
const ( MainDir = ".halfpipe" MainFileNamePrefix = "config" MainFileNameExt = "yaml" MainFileFullName = MainFileNamePrefix + "." + MainFileNameExt ConnectionsConfigFileNamePrefix = "connections" ConnectionsConfigFileNameExt = "yaml" ConnectionsConfigFileFullName = ConnectionsConfigFileNamePrefix + "." + ConnectionsConfigFileNameExt )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EncryptedFile ¶
type EncryptedFile struct { Dirname string FileName string FilePrefix string FileExt string FullPath string // contains filtered or unexported fields }
EncryptedFile is a simple struct able to split file paths into the components to improve readability of code.
func NewEncryptedFileInConfigHomeDir ¶
func NewEncryptedFileInConfigHomeDir(filename string) *EncryptedFile
func (*EncryptedFile) Get ¶
func (f *EncryptedFile) Get() (text []byte, err error)
func (*EncryptedFile) Set ¶
func (f *EncryptedFile) Set(text []byte) (err error)
type File ¶
type File struct { Dirname string FileName string FilePrefix string FileExt string FullPath string // contains filtered or unexported fields }
File is a simple struct able to split file paths into the components to improve readability of code.
var Connections *File
var Main *File
func NewConfigFile2WithDir ¶
func (*File) Get ¶
Get will fetch the key from the config File into variable, out. Supported out types are: string, ConnectionDetails. Return an error if we can't find the key.
func (*File) GetAllKeys ¶
func (*File) GetConnectionDetails ¶
func (c *File) GetConnectionDetails(connectionName string) (*shared.ConnectionDetails, error)
GetConnectionDetails fetches generic connection details from the File c using the connectionName to do the lookup. If the connection is not found the an error is produced.
func (*File) GetConnectionType ¶
GetConnectionType returns the connection type by un-marshalling the connection into an rdbms.DBConnectionDetails struct - so connections need to match that structure for now. Return an error if the key doesn't exist.
func (*File) LoadConnection ¶
func (c *File) LoadConnection(connectionName string) (shared.ConnectionDetails, error)
type FileNotFoundError ¶
type FileNotFoundError struct {
// contains filtered or unexported fields
}
FileNotFoundError denotes failing to find configuration file.
func (FileNotFoundError) Error ¶
func (f FileNotFoundError) Error() string
Error returns the formatted configuration error.
type KeyNotFoundError ¶
type KeyNotFoundError struct {
// contains filtered or unexported fields
}
func (KeyNotFoundError) Error ¶
func (k KeyNotFoundError) Error() string