package backend import ( "context" "os" ) // Env resolves refs through process-environment indirection: ref.Source // is the variable name. This is the crush exposure-minimization pattern — // configs carry env var NAMES, never literals. The value is read on // demand and kept in memory only. type Env struct{} // NewEnv returns the env backend. func NewEnv() *Env { return &Env{} } // Name implements Backend. func (e *Env) Name() string { return "env" } // Resolve implements Backend. func (e *Env) Resolve(ctx context.Context, ref Ref) (string, error) { v, ok := os.LookupEnv(ref.Source) if !ok { return "", Err(ref, e.Name(), ReasonMissingKey) } if v == "" { return "", Err(ref, e.Name(), ReasonEmptyValue) } return v, nil }