Documentation
¶
Overview ¶
Package secrets is EXPERIMENTAL — safe API key resolution for AXIS. It is subordinate to observed state and emits warnings automatically.
Package secrets is EXPERIMENTAL — safe API key resolution for AXIS. It is subordinate to observed state and emits warnings automatically.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("api key not found: neither env var nor file contained a value")
ErrNotFound is returned by Resolve when neither the environment variable nor the file path yields a non-empty value.
Functions ¶
func IsConfigured ¶
IsConfigured returns true if Resolve would succeed without error. It is a convenience wrapper for callers that only need to check presence.
func Resolve ¶
Resolve returns an API key by probing envVar then filePath.
- If envVar is non-empty and the named environment variable is set and non-empty, its value is returned immediately.
- If filePath is non-empty and the file exists and contains non-empty content (after trimming whitespace), that content is returned.
- Otherwise ErrNotFound is returned.
File read errors (permissions, etc.) are surfaced as wrapped errors so the caller can distinguish "not configured" from "configured but broken". The error message never contains the key value.
func ResolveOrEmpty ¶
ResolveOrEmpty calls Resolve and returns an empty string instead of an error when the key is simply not configured (ErrNotFound). File read errors are still surfaced so misconfigured paths are not silently ignored.
Use this when missing credentials should degrade gracefully (e.g. skipping a cloud provider) rather than hard-failing.
Types ¶
This section is empty.