secret

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package secret resolves and loads secrets referenced from config. A reference is either a bare filesystem path or a scheme URI (e.g. "file://…"); the scheme selects the Source. Only the file source is implemented now; new schemes (e.g. "op://") add a case without changing callers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSource

type FileSource struct{ Path string }

FileSource loads the secret from a file.

func (FileSource) Load

func (s FileSource) Load() (string, error)

Load reads the file, trims surrounding whitespace, and errors if the file is missing or the trimmed content is empty.

type Source

type Source interface {
	Load() (string, error)
}

Source reads a single resolved secret value.

func Resolve

func Resolve(ref string) (Source, error)

Resolve inspects ref and returns the matching Source. A ref containing "://" is parsed as <scheme>://<rest>; otherwise the whole ref is a file path. Path forms expand a leading "~" to the home directory.

Jump to

Keyboard shortcuts

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