teamvault

package module
v0.0.0-...-31104c7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2024 License: BSD-2-Clause Imports: 20 Imported by: 3

README

Teamvault Utils

Generate config directory with Teamvault secrets

Install:

go get github.com/bborbe/teamvault-utils/cmd/teamvault-config-dir-generator

Config:

{
    "url": "https://teamvault.example.com",
    "user": "my-user",
    "pass": "my-pass"
}

Run:

teamvault-config-dir-generator \
-teamvault-config="~/.teamvault.json" \
-source-dir=templates \
-target-dir=results \
-logtostderr \
-v=2

Parse variable Teamvault secrets

Install:

go get github.com/bborbe/teamvault-utils/cmd/teamvault-config-parser

Sample config:

foo=bar
username={{ "vLVLbm" | teamvaultUser }}
password={{ "vLVLbm" | teamvaultPassword }}
bar=foo 

Run:

cat my.config | teamvault-config-parser
-teamvault-config="~/.teamvault.json" \
-logtostderr \
-v=2

Teamvault Get Username

Install:

go get github.com/bborbe/teamvault-utils/cmd/teamvault-username

Run:

teamvault-username \
--teamvault-config ~/.teamvault-sm.json \
--teamvault-key vLVLbm

Teamvault Get Password

Install:

go get github.com/bborbe/teamvault-utils/cmd/teamvault-password

Run:

teamvault-password \
--teamvault-config ~/.teamvault-sm.json \
--teamvault-key vLVLbm

Teamvault Get Url

Install:

go get github.com/bborbe/teamvault-utils/cmd/teamvault-url

Run:

teamvault-url \
--teamvault-config ~/.teamvault-sm.json \
--teamvault-key vLVLbm

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHttpClient

func CreateHttpClient() *http.Client

Types

type ApiUrl

type ApiUrl string

func (ApiUrl) Key

func (a ApiUrl) Key() (Key, error)

func (ApiUrl) String

func (a ApiUrl) String() string

type Config

type Config struct {
	Url          Url      `json:"url"`
	User         User     `json:"user"`
	Password     Password `json:"pass"`
	CacheEnabled bool     `json:"cacheEnabled,omitempty"`
}

func ParseTeamvaultConfig

func ParseTeamvaultConfig(content []byte) (*Config, error)

type ConfigGenerator

type ConfigGenerator interface {
	Generate(ctx context.Context, sourceDirectory SourceDirectory, targetDirectory TargetDirectory) error
}

func NewConfigGenerator

func NewConfigGenerator(configParser ConfigParser) ConfigGenerator

type ConfigParser

type ConfigParser interface {
	Parse(ctx context.Context, content []byte) ([]byte, error)
}

func NewConfigParser

func NewConfigParser(
	teamvaultConnector Connector,
) ConfigParser

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)
}

func CreateConnector

func CreateConnector(
	apiURL Url,
	apiUser User,
	apiPassword Password,
	staging Staging,
	cacheEnabled bool,
) Connector

func CreateConnectorWithConfig

func CreateConnectorWithConfig(
	configPath TeamvaultConfigPath,
	apiURL Url,
	apiUser User,
	apiPassword Password,
	staging Staging,
	cacheEnabled bool,
) (Connector, error)

func CreateRemoteConnector

func CreateRemoteConnector(
	apiURL Url,
	apiUser User,
	apiPassword Password,
) Connector

func NewCacheConnector

func NewCacheConnector(connector Connector) Connector

func NewDiskFallbackConnector

func NewDiskFallbackConnector(connector Connector) Connector

func NewDummyConnector

func NewDummyConnector() Connector

func NewRemoteConnector

func NewRemoteConnector(
	httpClient *http.Client,
	url Url,
	user User,
	pass Password,
) Connector

type CurrentRevision

type CurrentRevision string

func (CurrentRevision) String

func (t CurrentRevision) String() string

type File

type File string

func (File) Content

func (t File) Content() ([]byte, error)

func (File) String

func (t File) String() string

type HtpasswdGenerator

type HtpasswdGenerator interface {
	Generate(ctx context.Context, key Key) ([]byte, error)
}

func NewHtpasswdGenerator

func NewHtpasswdGenerator(connector Connector) HtpasswdGenerator

type Key

type Key string

func (Key) String

func (k Key) String() string

type Password

type Password string

func (Password) String

func (t Password) String() string

type SourceDirectory

type SourceDirectory string

func (SourceDirectory) String

func (s SourceDirectory) String() string

type Staging

type Staging bool

func (Staging) Bool

func (s Staging) Bool() bool

type TargetDirectory

type TargetDirectory string

func (TargetDirectory) String

func (t TargetDirectory) String() string

type TeamvaultConfigPath

type TeamvaultConfigPath string

func (TeamvaultConfigPath) Exists

func (t TeamvaultConfigPath) Exists() bool

Exists the backup

func (TeamvaultConfigPath) NormalizePath

func (t TeamvaultConfigPath) NormalizePath() (TeamvaultConfigPath, error)

func (TeamvaultConfigPath) Parse

func (t TeamvaultConfigPath) Parse() (*Config, error)

func (TeamvaultConfigPath) String

func (t TeamvaultConfigPath) String() string

type Url

type Url string

func (Url) String

func (u Url) String() string

type User

type User string

func (User) String

func (u User) String() string

Directories

Path Synopsis
cmd
teamvault-file command
teamvault-url command
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL