teamvault

package module
v0.0.0-...-daa2672 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: BSD-2-Clause Imports: 19 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

This section is empty.

Types

type Cache

type Cache struct {
	Connector Connector
	Passwords map[Key]Password
	Users     map[Key]User
	Urls      map[Key]Url
	Files     map[Key]File
}

func (*Cache) File

func (c *Cache) File(ctx context.Context, key Key) (File, error)

func (*Cache) Password

func (c *Cache) Password(ctx context.Context, key Key) (Password, error)

func (*Cache) Search

func (c *Cache) Search(ctx context.Context, key string) ([]Key, error)

func (*Cache) Url

func (c *Cache) Url(ctx context.Context, key Key) (Url, error)

func (*Cache) User

func (c *Cache) User(ctx context.Context, key Key) (User, error)

type ConfigGenerator

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

func NewGenerator

func NewGenerator(configParser ConfigParser) ConfigGenerator

type ConfigParser

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

func NewParser

func NewParser(
	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 NewCache

func NewCache(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 File

type File string

func (File) Content

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

func (File) String

func (t File) String() string

type Htpasswd

type Htpasswd struct {
	Connector Connector
}

func (*Htpasswd) Generate

func (c *Htpasswd) Generate(ctx context.Context, key Key) ([]byte, error)

type Key

type Key string

func (Key) String

func (t 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 TeamvaultApiUrl

type TeamvaultApiUrl string

func (TeamvaultApiUrl) Key

func (t TeamvaultApiUrl) Key() (Key, error)

func (TeamvaultApiUrl) String

func (t TeamvaultApiUrl) String() string

type TeamvaultConfig

type TeamvaultConfig struct {
	Url      Url      `json:"url"`
	User     User     `json:"user"`
	Password Password `json:"pass"`
}

func ParseTeamvaultConfig

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

type TeamvaultConfigPath

type TeamvaultConfigPath string

func (TeamvaultConfigPath) Exists

func (t TeamvaultConfigPath) Exists() bool

Exists the backup

func (TeamvaultConfigPath) NormalizePath

func (d TeamvaultConfigPath) NormalizePath() (TeamvaultConfigPath, error)

func (TeamvaultConfigPath) Parse

func (TeamvaultConfigPath) String

func (t TeamvaultConfigPath) String() string

type TeamvaultCurrentRevision

type TeamvaultCurrentRevision string

func (TeamvaultCurrentRevision) String

func (t TeamvaultCurrentRevision) String() string

type Url

type Url string

func (Url) String

func (t Url) String() string

type User

type User string

func (User) String

func (t User) String() string

type VariableName

type VariableName string

func (VariableName) String

func (v VariableName) String() string

Directories

Path Synopsis
cmd
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