secrets

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerSecretsManager

type DockerSecretsManager struct {
	// contains filtered or unexported fields
}

DockerSecretsManager handles Docker Swarm secrets (for backward compatibility)

func NewDockerSecretsManager

func NewDockerSecretsManager(client *ssh.Client, project, environment string, verbose bool) *DockerSecretsManager

NewDockerSecretsManager creates a new Docker secrets manager

func (*DockerSecretsManager) CleanupUnusedSecrets

func (m *DockerSecretsManager) CleanupUnusedSecrets(usedSecrets []string) error

CleanupUnusedSecrets removes secrets that are no longer referenced

func (*DockerSecretsManager) EnsureSecret

func (m *DockerSecretsManager) EnsureSecret(secret config.SecretConfig) (string, error)

EnsureSecret creates or updates a Docker secret Returns the secret name that was created

func (*DockerSecretsManager) GetSecretName

func (m *DockerSecretsManager) GetSecretName(secret config.SecretConfig) string

GetSecretName returns the full secret name for a given secret config

func (*DockerSecretsManager) GetSecretTarget

func (m *DockerSecretsManager) GetSecretTarget(secret config.SecretConfig) string

GetSecretTarget returns the target path for a secret in the container

type EnvFile

type EnvFile struct {
	// contains filtered or unexported fields
}

EnvFile represents a Docker environment file

func NewEnvFile

func NewEnvFile() *EnvFile

NewEnvFile creates a new environment file

func (*EnvFile) Count

func (ef *EnvFile) Count() int

Count returns the number of environment variables

func (*EnvFile) Get

func (ef *EnvFile) Get(key string) (string, bool)

Get retrieves an environment variable value

func (*EnvFile) GetAll

func (ef *EnvFile) GetAll() map[string]string

GetAll returns all key-value pairs (use cautiously, may contain secrets)

func (*EnvFile) GetCreatedAt

func (ef *EnvFile) GetCreatedAt() time.Time

GetCreatedAt returns when this env file was created

func (*EnvFile) GetID

func (ef *EnvFile) GetID() string

GetID returns the unique ID of this env file

func (*EnvFile) GetKeys

func (ef *EnvFile) GetKeys() []string

GetKeys returns all environment variable keys (for debugging)

func (*EnvFile) GetPath

func (ef *EnvFile) GetPath(projectName, serviceName string) string

GetPath returns the temporary file path on the server

func (*EnvFile) Set

func (ef *EnvFile) Set(key, value string)

Set adds or updates an environment variable

func (*EnvFile) Size

func (ef *EnvFile) Size() int

Size returns the approximate size of the env file in bytes

func (*EnvFile) ToReader

func (ef *EnvFile) ToReader() io.Reader

ToReader returns an io.Reader with the env file contents

func (*EnvFile) Validate

func (ef *EnvFile) Validate() error

Validate checks if the env file is valid

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(environment string) (*Manager, error)

NewManager creates a new secrets manager for the given environment

func (*Manager) CreateEnvFile

func (m *Manager) CreateEnvFile(service *config.ServiceConfig) (*EnvFile, error)

CreateEnvFile creates a Docker env file for a service

func (*Manager) Delete

func (m *Manager) Delete(key string, environment string) error

Delete removes a secret

func (*Manager) Get

func (m *Manager) Get(key string) (string, error)

Get retrieves a secret value by key

func (*Manager) GetRedactor

func (m *Manager) GetRedactor() *Redactor

GetRedactor returns the redactor for output sanitization

func (*Manager) IsSensitive

func (m *Manager) IsSensitive(key string) bool

IsSensitive checks if a key name indicates sensitive data

func (*Manager) List

func (m *Manager) List() []string

List returns all secret keys (values are not returned for security)

func (*Manager) Set

func (m *Manager) Set(key, value string, environment string) error

Set sets a secret value

func (*Manager) ValidateRequired

func (m *Manager) ValidateRequired(required []string) error

ValidateRequired checks if all required secrets are present

type Redactor

type Redactor struct {
	// contains filtered or unexported fields
}

Redactor automatically redacts sensitive information from output

func NewRedactor

func NewRedactor() *Redactor

NewRedactor creates a new redactor

func (*Redactor) Clear

func (r *Redactor) Clear()

Clear removes all registered secrets

func (*Redactor) IsSensitiveKey

func (r *Redactor) IsSensitiveKey(key string) bool

IsSensitiveKey checks if a key name indicates sensitive data

func (*Redactor) Redact

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

Redact removes sensitive information from text

func (*Redactor) RedactMap

func (r *Redactor) RedactMap(data map[string]string) map[string]string

RedactMap redacts sensitive values in a map

func (*Redactor) Register

func (r *Redactor) Register(value string)

Register marks a specific value for redaction

type SafeOutput

type SafeOutput struct {
	// contains filtered or unexported fields
}

SafeOutput wraps output functions to automatically redact sensitive data

func NewSafeOutput

func NewSafeOutput(redactor *Redactor) *SafeOutput

NewSafeOutput creates a new safe output wrapper

func (*SafeOutput) Debug

func (so *SafeOutput) Debug(verbose bool, format string, args ...interface{})

Debug prints a debug message (only if verbose mode)

func (*SafeOutput) Error

func (so *SafeOutput) Error(err error) error

Error creates a redacted error

func (*SafeOutput) Errorf

func (so *SafeOutput) Errorf(format string, args ...interface{}) error

Errorf creates a formatted redacted error

func (*SafeOutput) Info

func (so *SafeOutput) Info(format string, args ...interface{})

Info prints an info message

func (*SafeOutput) Print

func (so *SafeOutput) Print(args ...interface{})

Print prints redacted output

func (*SafeOutput) Printf

func (so *SafeOutput) Printf(format string, args ...interface{})

Printf formats and prints redacted output

func (*SafeOutput) Println

func (so *SafeOutput) Println(args ...interface{})

Println prints redacted output with newline

func (*SafeOutput) SetWriter

func (so *SafeOutput) SetWriter(w io.Writer)

SetWriter sets the output writer (for testing)

func (*SafeOutput) Success

func (so *SafeOutput) Success(format string, args ...interface{})

Success prints a success message with checkmark

func (*SafeOutput) Warning

func (so *SafeOutput) Warning(format string, args ...interface{})

Warning prints a warning message

Jump to

Keyboard shortcuts

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