Documentation
¶
Overview ¶
Package teamvault provides utilities for accessing and managing TeamVault secrets.
TeamVault is a secret management system, and this package offers Go clients for retrieving passwords, users, URLs, and files from TeamVault instances. It includes various connector implementations for different use cases including remote access, caching, disk fallback, and testing.
The package also provides configuration parsing and generation capabilities to replace TeamVault placeholders in configuration templates with actual secret values.
Index ¶
- func NormalizePath(path string) (string, error)
- type ApiUrl
- type Config
- type ConfigGenerator
- type ConfigParser
- type Connector
- type CurrentRevision
- type File
- type HtpasswdGenerator
- type Key
- type Password
- type SourceDirectory
- type Staging
- type TargetDirectory
- type TeamvaultConfigPath
- type Url
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizePath ¶ added in v4.6.1
NormalizePath converts a path to an absolute path, expanding ~ to the home directory.
Types ¶
type ApiUrl ¶
type ApiUrl string
ApiUrl represents a TeamVault API URL.
type Config ¶
type Config struct {
Url Url `json:"url"`
User User `json:"user"`
Password Password `json:"pass"`
CacheEnabled bool `json:"cacheEnabled,omitempty"`
}
Config holds the configuration for connecting to a TeamVault instance.
func ParseTeamvaultConfig ¶
ParseTeamvaultConfig parses a TeamVault configuration from JSON content.
type ConfigGenerator ¶
type ConfigGenerator interface {
Generate(
ctx context.Context,
sourceDirectory SourceDirectory,
targetDirectory TargetDirectory,
) error
}
ConfigGenerator generates configuration files by parsing templates and replacing TeamVault placeholders.
func NewConfigGenerator ¶
func NewConfigGenerator(configParser ConfigParser) ConfigGenerator
NewConfigGenerator creates a new ConfigGenerator with the given ConfigParser.
type ConfigParser ¶
ConfigParser parses configuration templates and replaces TeamVault placeholders with actual values.
func NewConfigParser ¶
func NewConfigParser( teamvaultConnector Connector, ) ConfigParser
NewConfigParser creates a new ConfigParser with the given TeamVault Connector.
type Connector ¶
type Connector interface {
Password(ctx context.Context, key Key) (Password, error)
User(ctx context.Context, key Key) (User, error)
Url(ctx context.Context, key Key) (Url, error)
File(ctx context.Context, key Key) (File, error)
Search(ctx context.Context, name string) ([]Key, error)
}
Connector provides access to TeamVault secrets including passwords, users, URLs, and files.
func NewCacheConnector ¶
NewCacheConnector creates a new Connector that caches responses from the underlying connector.
func NewDiskFallbackConnector ¶
NewDiskFallbackConnector creates a new Connector that uses disk cache as fallback when the underlying connector fails.
func NewDummyConnector ¶
func NewDummyConnector() Connector
NewDummyConnector creates a new Connector that returns deterministic dummy values for testing.
func NewRemoteConnector ¶
func NewRemoteConnector( httpClient *http.Client, url Url, user User, pass Password, currentDateTime time.CurrentDateTime, ) Connector
NewRemoteConnector creates a new Connector that connects to a remote TeamVault instance.
type CurrentRevision ¶
type CurrentRevision string
CurrentRevision represents the current revision identifier of a TeamVault secret.
func (CurrentRevision) String ¶
func (t CurrentRevision) String() string
String returns the string representation of the CurrentRevision.
type File ¶
type File string
File represents a base64-encoded file stored in TeamVault.
type HtpasswdGenerator ¶
HtpasswdGenerator generates htpasswd formatted credentials from TeamVault secrets.
func NewHtpasswdGenerator ¶
func NewHtpasswdGenerator(connector Connector) HtpasswdGenerator
NewHtpasswdGenerator creates a new HtpasswdGenerator with the given Connector.
type Key ¶
type Key string
Key represents a TeamVault secret identifier.
type Password ¶
type Password string
Password represents a TeamVault password.
func (*Password) UnmarshalJSON ¶ added in v4.7.5
UnmarshalJSON implements json.Unmarshaler to handle both string and number types.
type SourceDirectory ¶
type SourceDirectory string
SourceDirectory represents the source directory path for configuration generation.
func (SourceDirectory) String ¶
func (s SourceDirectory) String() string
String returns the string representation of the SourceDirectory.
type Staging ¶
type Staging bool
Staging indicates whether the TeamVault instance is a staging environment.
type TargetDirectory ¶
type TargetDirectory string
TargetDirectory represents the target directory path for configuration generation.
func (TargetDirectory) String ¶
func (t TargetDirectory) String() string
String returns the string representation of the TargetDirectory.
type TeamvaultConfigPath ¶
type TeamvaultConfigPath string
TeamvaultConfigPath represents a path to a TeamVault configuration file.
func (TeamvaultConfigPath) Exists ¶
func (t TeamvaultConfigPath) Exists() bool
Exists checks if the TeamvaultConfigPath points to an existing non-empty file.
func (TeamvaultConfigPath) NormalizePath ¶
func (t TeamvaultConfigPath) NormalizePath() (TeamvaultConfigPath, error)
NormalizePath converts the TeamvaultConfigPath to an absolute path.
func (TeamvaultConfigPath) Parse ¶
func (t TeamvaultConfigPath) Parse() (*Config, error)
Parse reads and parses the TeamVault configuration from the file.
func (TeamvaultConfigPath) String ¶
func (t TeamvaultConfigPath) String() string
String returns the string representation of the TeamvaultConfigPath.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
teamvault-config-dir-generator
command
|
|
|
teamvault-config-parser
command
|
|
|
teamvault-file
command
|
|
|
teamvault-password
command
|
|
|
teamvault-url
command
|
|
|
teamvault-username
command
|
|
|
Package factory provides factory functions for creating TeamVault connectors and HTTP clients.
|
Package factory provides factory functions for creating TeamVault connectors and HTTP clients. |
|
Code generated by counterfeiter.
|
Code generated by counterfeiter. |