secretsyml

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 7 Imported by: 1

README

github.com/cyberark/summon/pkg/secretsyml

Defines the secret.yml format and provides function to parse it into a map.

Documentation

Overview

Package secretsyml provides functions for parsing a string or file in secrets.yml format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileConfig added in v0.11.0

type FileConfig struct {
	Path        string      `yaml:"path"`
	Format      string      `yaml:"format"`      // "template", "yaml", "dotenv", "json", etc.
	Template    string      `yaml:"template"`    // Custom template content
	Secrets     interface{} `yaml:"secrets"`     // Will be parsed as SecretsMap or map[string]SecretsMap
	Overwrite   bool        `yaml:"overwrite"`   // Whether to overwrite existing files
	Permissions os.FileMode `yaml:"permissions"` // File permissions (e.g., 0644)
	// contains filtered or unexported fields
}

FileConfig represents a single file to be created with secrets.

func (*FileConfig) UnmarshalYAML added in v0.11.0

func (fc *FileConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML preserves the raw YAML node for secrets so tags aren't lost.

func (*FileConfig) Validate added in v0.11.0

func (fileConfig *FileConfig) Validate() error

Validate checks that the FileConfig has all required fields.

type ParsedConfig added in v0.11.0

type ParsedConfig struct {
	EnvSecrets SecretsMap
	Files      []FileConfig
}

ParsedConfig holds the parsed secrets.yml content: environment variable secrets and file-based secret configurations.

func ParseFromFile

func ParseFromFile(filepath, env string, subs map[string]string) (*ParsedConfig, error)

ParseFromFile reads and parses a secrets.yml file into a ParsedConfig.

func ParseFromString

func ParseFromString(content, env string, subs map[string]string) (*ParsedConfig, error)

ParseFromString parses a secrets.yml string into a ParsedConfig.

func (*ParsedConfig) FileSecrets added in v0.11.0

func (config *ParsedConfig) FileSecrets() SecretsMap

func (*ParsedConfig) HasEnvSecrets added in v0.11.0

func (config *ParsedConfig) HasEnvSecrets() bool

func (*ParsedConfig) HasFileSecrets added in v0.11.0

func (config *ParsedConfig) HasFileSecrets() bool

type SecretSpec

type SecretSpec struct {
	Tags         []YamlTag // How to treat the value: variable lookup, file, or literal.
	Path         string    // Provider path to fetch, or a literal value.
	DefaultValue string    // Fallback if the provider returns an empty string.
}

SecretSpec is a parsed secrets.yml entry describing *what* to fetch. It captures the YAML tag metadata (e.g. !var, !file) and the provider path but intentionally has no Value field — the actual secret content is only known after the provider is called (see provider.Result).

func (*SecretSpec) IsFile

func (spec *SecretSpec) IsFile() bool

func (*SecretSpec) IsLiteral

func (spec *SecretSpec) IsLiteral() bool

func (*SecretSpec) IsVar

func (spec *SecretSpec) IsVar() bool

type SecretsMap

type SecretsMap map[string]SecretSpec

SecretsMap maps environment variable names or aliases to their SecretSpec.

func (*SecretsMap) UnmarshalYAML

func (secretMap *SecretsMap) UnmarshalYAML(unmarshal func(interface{}) error) error

type YamlTag

type YamlTag uint8

YamlTag represents the type annotation on a secrets.yml value.

const (
	File YamlTag = iota
	Var
	Literal
)

func (YamlTag) String

func (t YamlTag) String() string

Jump to

Keyboard shortcuts

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