store

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListApps

func ListApps(dir string) ([]string, error)

ListApps returns sorted unique app names from .age files in the directory.

func ListEnvs

func ListEnvs(dir, app string) ([]string, error)

ListEnvs returns sorted environment names for the given app.

func ParseEnv

func ParseEnv(content string) ([]entry, error)

ParseEnv parses .env formatted content into entries. Supports comments (#), blank lines, unquoted values, single-quoted values, double-quoted values (with multiline support), and export prefix.

func Serialize

func Serialize(entries []entry) string

Serialize converts entries back to .env format.

Types

type Store

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

Store manages secrets for a single app+env combination.

func New

func New(dir, app, env string, identity *age.X25519Identity) *Store

New creates a new Store. It does not load from disk yet; call Load() for that.

func (*Store) Delete

func (s *Store) Delete(key string) bool

Delete removes a key. Returns true if the key existed.

func (*Store) Dump

func (s *Store) Dump() map[string]string

Dump returns all key-value pairs as a map.

func (*Store) DumpOrdered

func (s *Store) DumpOrdered() []entry

DumpOrdered returns keys in the order they appear.

func (*Store) FilePath

func (s *Store) FilePath() string

FilePath returns the path to the encrypted .age file.

func (*Store) Get

func (s *Store) Get(key string) (string, bool)

Get returns the value for the given key, and whether it exists.

func (*Store) Import

func (s *Store) Import(content string) error

Import merges key-value pairs from parsed .env content. Existing keys are overwritten.

func (*Store) List

func (s *Store) List() []string

List returns all key names in order.

func (*Store) Load

func (s *Store) Load() error

Load reads and decrypts the .age file, parsing its contents. If the file doesn't exist, the store starts empty (no error).

func (*Store) RawContent

func (s *Store) RawContent() string

RawContent returns the serialized .env content.

func (*Store) Save

func (s *Store) Save() error

Save encrypts and writes the store contents to the .age file.

func (*Store) Set

func (s *Store) Set(key, value string)

Set adds or updates a key-value pair.

func (*Store) SetRaw

func (s *Store) SetRaw(content string) error

SetRaw replaces the store contents with the given raw .env content.

Jump to

Keyboard shortcuts

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