util

package
v0.0.0-...-4bd0441 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunCmdPTY

func RunCmdPTY(cmd *exec.Cmd, secretEnvs []string, redact bool) error

RunCmdPTY runs the given command in a pseudo-terminal

Types

type Redactor

type Redactor struct {
	Writer io.Writer
	Envs   []string
	Redact bool
}

Redactor wraps an io.Writer to redact sensitive values from the output.

func (*Redactor) Write

func (r *Redactor) Write(p []byte) (n int, err error)

Write implements the io.Writer interface, redacting sensitive values from p before writing to the underlying Writer.

type Secret

type Secret struct {
	Append    *bool  `json:"append,omitempty"      yaml:"append,omitempty"`
	Prefix    string `json:"prefix,omitempty"      yaml:"prefix,omitempty"`
	Format    string `json:"format,omitempty"      yaml:"format,omitempty"      mapstructure:"format,omitempty"`
	FileName  string `json:"filename,omitempty"    yaml:"filename,omitempty"    mapstructure:"filename,omitempty"`
	UpperCase *bool  `json:"uppercase,omitempty"   yaml:"uppercase,omitempty"`
	Keys      []any  `json:"keys,omitempty"        yaml:"keys,omitempty"`
	Owner     *int   `json:"owner,omitempty"       yaml:"owner,omitempty"`
}

Secret holds the configuration for a secret

type SecretJSON

type SecretJSON struct {
	Append        *bool  `json:"append,omitempty"      yaml:"append,omitempty"`
	Format        string `json:"format,omitempty"      yaml:"format,omitempty"`
	Output        string `json:"output,omitempty"      yaml:"output,omitempty"`
	Owner         *int   `json:"owner,omitempty"       yaml:"owner,omitempty"`
	Prefix        string `json:"prefix,omitempty"      yaml:"prefix,omitempty"`
	UpperCase     *bool  `json:"uppercase,omitempty"   yaml:"uppercase,omitempty"`
	Secrets       []any  `json:"secrets,omitempty"     yaml:"secrets,omitempty"`
	GcpWorkloadID bool   `json:"gcpWorkloadID,omitempty"     yaml:"gcpWorkloadID,omitempty"`
}

SecretJSON holds the information about which secrets to fetch and how to save them again

func ReadInput

func ReadInput(input string) SecretJSON

ReadInput will read the input given to Harpocrates and try to parse it to SecretJSON Will also set some default values

type SecretKeys

type SecretKeys struct {
	Append     *bool  `json:"append,omitempty"         yaml:"append,omitempty"`
	Prefix     string `json:"prefix,omitempty"         yaml:"prefix,omitempty"      mapstructure:"prefix,omitempty"`
	UpperCase  *bool  `json:"uppercase,omitempty"      yaml:"uppercase,omitempty"   mapstructure:"uppercase,omitempty"`
	SaveAsFile *bool  `json:"saveAsFile,omitempty"     yaml:"saveAsFile,omitempty"`
	Alias      string `json:"alias,omitempty"          yaml:"alias,omitempty"       mapstructure:"alias,omitempty"`
}

SecretKeys holds the configuration for secret keys

Jump to

Keyboard shortcuts

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