pkg

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TellerFileTemplate = `` /* 6504-byte string literal not displayed */

Functions

This section is empty.

Types

type BuiltinProviders

type BuiltinProviders struct {
}

func (*BuiltinProviders) GetProvider

func (p *BuiltinProviders) GetProvider(name string) (core.Provider, error)

func (*BuiltinProviders) ProviderHumanToMachine

func (p *BuiltinProviders) ProviderHumanToMachine() map[string]string

type MappingConfig

type MappingConfig struct {
	Kind       string                   `yaml:"kind,omitempty"`
	EnvMapping *core.KeyPath            `yaml:"env_sync,omitempty"`
	Env        *map[string]core.KeyPath `yaml:"env,omitempty"`
}

type Porcelain

type Porcelain struct {
	Out io.Writer
}

func (*Porcelain) AskForConfirmation

func (p *Porcelain) AskForConfirmation(msg string) bool

func (*Porcelain) DidCreateNewFile

func (p *Porcelain) DidCreateNewFile(fname string)

func (*Porcelain) DidDeleteKP added in v1.5.0

func (p *Porcelain) DidDeleteKP(kp core.KeyPath, pname string)

func (*Porcelain) DidDeleteP added in v1.5.0

func (p *Porcelain) DidDeleteP(path, pname string)

func (*Porcelain) DidPutKVP added in v1.3.0

func (p *Porcelain) DidPutKVP(kvp core.KeyPath, pname string, sync bool)

func (*Porcelain) NoDeleteKP added in v1.5.0

func (p *Porcelain) NoDeleteKP(k, pname string)

func (*Porcelain) NoPutKVP added in v1.3.0

func (p *Porcelain) NoPutKVP(k, pname string)

func (*Porcelain) PrintContext

func (p *Porcelain) PrintContext(projectName, loadedFrom string)

func (*Porcelain) PrintDrift added in v1.1.0

func (p *Porcelain) PrintDrift(drifts []core.DriftedEntry)

func (*Porcelain) PrintEntries

func (p *Porcelain) PrintEntries(entries []core.EnvEntry)

func (*Porcelain) PrintMatchSummary added in v1.0.0

func (p *Porcelain) PrintMatchSummary(findings []core.Match, entries []core.EnvEntry, elapsed time.Duration)

func (*Porcelain) PrintMatches added in v1.0.0

func (p *Porcelain) PrintMatches(matches []core.Match)

func (*Porcelain) StartWizard

func (p *Porcelain) StartWizard() (*core.WizardAnswers, error)

func (*Porcelain) VSpace

func (p *Porcelain) VSpace(size int)

type Providers

type Providers interface {
	GetProvider(name string) (core.Provider, error)
	ProviderHumanToMachine() map[string]string
}

type ProvidersMap added in v1.1.0

type ProvidersMap map[string]MappingConfig

type Redactor added in v1.0.0

type Redactor struct {
	Entries []core.EnvEntry
}

func NewRedactor added in v1.0.0

func NewRedactor(entries []core.EnvEntry) *Redactor

func (*Redactor) Redact added in v1.0.0

func (r *Redactor) Redact(s string) string

type Teller

type Teller struct {
	Redact     bool
	Cmd        []string
	Config     *TellerFile
	Porcelain  *Porcelain
	Populate   *core.Populate
	Providers  Providers
	Entries    []core.EnvEntry
	Templating *Templating
	Redactor   *Redactor
	Logger     logging.Logger
}

Teller Cmd - command to execute if any given. Porcelain - wrapping teller in a nice porcelain; in other words the textual UI for teller. Providers - the available providers to use. Entries - when loaded, these contains the mapped entries. Load them with Collect() Templating - Teller's templating options.

func NewTeller

func NewTeller(tlrfile *TellerFile, cmd []string, redact bool, logger logging.Logger) *Teller

Create a new Teller instance, using a tellerfile, and a command to execute (if any)

func (*Teller) Collect

func (tl *Teller) Collect() error

The main "load all variables from all providers" logic. Walks over all definitions in the tellerfile and then: fetches, converts, creates a new EnvEntry. We're also mapping the sensitivity aspects of it. Note that for a similarly named entry - last one wins.

func (*Teller) CollectFromProvider added in v1.3.0

func (tl *Teller) CollectFromProvider(pname string) ([]core.EnvEntry, error)

func (*Teller) CollectFromProviderMap added in v1.1.0

func (tl *Teller) CollectFromProviderMap(ps *ProvidersMap) ([]core.EnvEntry, error)

func (*Teller) Delete added in v1.5.0

func (tl *Teller) Delete(keys, providerNames []string, directPath string, allKeys bool) error

func (*Teller) Drift added in v1.1.0

func (tl *Teller) Drift(providerNames []string) []core.DriftedEntry

func (*Teller) Exec

func (tl *Teller) Exec()

Execute a command with teller. This requires all entries to be loaded beforehand with Collect()

func (*Teller) ExportDotenv

func (tl *Teller) ExportDotenv() string

Export variables into a .env format (basically a KEY=VAL format, that's also compatible with Docker)

func (*Teller) ExportEnv

func (tl *Teller) ExportEnv() string

Export variables into a shell sourceable format

func (*Teller) ExportJSON added in v1.2.0

func (tl *Teller) ExportJSON() (out string, err error)

func (*Teller) ExportYAML added in v1.2.0

func (tl *Teller) ExportYAML() (out string, err error)

func (*Teller) GetProviderByName added in v1.3.0

func (tl *Teller) GetProviderByName(pname string) (*MappingConfig, core.Provider, error)

func (*Teller) MirrorDrift added in v1.3.0

func (tl *Teller) MirrorDrift(source, target string) ([]core.DriftedEntry, error)

func (*Teller) PrintEnvKeys

func (tl *Teller) PrintEnvKeys()

func (*Teller) Put added in v1.3.0

func (tl *Teller) Put(kvmap map[string]string, providerNames []string, sync bool, directPath string) error

func (*Teller) RedactLines added in v1.0.0

func (tl *Teller) RedactLines(r io.Reader, w io.Writer) error

Execute a command with teller. This requires all entries to be loaded beforehand with Collect()

func (*Teller) Scan added in v1.0.0

func (tl *Teller) Scan(path string, silent bool) ([]core.Match, error)

Scan for entries. Each of the mapped entries is considered highly sensitive unless stated other wise (with sensitive: high|medium|low|none) as such, we can offer a security scan to locate those in the current codebase (if the entries are sensitive and are placed inside a vault or similar store, what's the purpose of hardcoding these? let's help ourselves and locate throughout all the files in the path given)

func (*Teller) SetupNewProject

func (tl *Teller) SetupNewProject(fname string) error

Start an interactive wizard, that will create a file when completed.

func (*Teller) Sync added in v1.3.0

func (tl *Teller) Sync(from string, to []string, sync bool) error

func (*Teller) Template added in v1.5.0

func (tl *Teller) Template(from, to string) error

Template Teller vars from a given path (can be file or folder)

type TellerFile

type TellerFile struct {
	Opts       map[string]string `yaml:"opts,omitempty"`
	Confirm    string            `yaml:"confirm,omitempty"`
	Project    string            `yaml:"project,omitempty"`
	CarryEnv   bool              `yaml:"carry_env,omitempty"`
	Providers  ProvidersMap      `yaml:"providers,omitempty"`
	LoadedFrom string
}

func NewTellerFile

func NewTellerFile(s string) (*TellerFile, error)

type Templating

type Templating struct {
}

func (*Templating) ForGlob

func (t *Templating) ForGlob() *Templating

func (*Templating) ForTemplate

func (t *Templating) ForTemplate(tmpl string, entries []core.EnvEntry) (string, error)

func (*Templating) New

func (t *Templating) New() *Templating

Directories

Path Synopsis
mock_providers
Package mock_providers is a generated GoMock package.
Package mock_providers is a generated GoMock package.

Jump to

Keyboard shortcuts

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