Documentation
¶
Index ¶
Constants ¶
const Timeout = 10 * time.Second
Variables ¶
This section is empty.
Functions ¶
func ExtractEnvVars ¶
func ExtractEnvVars(name string, cfg *config.FileConfig) map[string]bool
ExtractEnvVars parses the template referenced by cfg and walks its AST to find all statically-referenced environment variable names (via env "KEY" and envDefault "KEY" "fallback" calls). Returns the set of referenced var names, or nil on any error (parse failure, missing template, command mode) as a "keep all env" fallback.
func FilterEnv ¶
FilterEnv returns a filtered copy of env containing only the variables referenced by cfg's template. Returns nil if env is nil (global layer). For command-mode files, returns only the allowlist vars (PATH, HOME, etc.) since referenced variables cannot be statically extracted. Returns the original env unchanged if extraction fails (safe fallback).
Types ¶
type CommandRenderer ¶
type CommandRenderer struct{}
type NativeRenderer ¶
type NativeRenderer struct {
// contains filtered or unexported fields
}
NativeRenderer uses Go's text/template with sprout functions and custom builtins: env, envDefault, file, exec. Parsed template texts are cached so that repeated renders (e.g. FUSE open()) skip disk I/O and re-parsing. The cache is invalidated when the template file's mtime changes.
type TemplateRenderer ¶
type TemplateRenderer interface {
Render(
name string,
cfg *config.FileConfig,
envLookup EnvLookup,
envOverrides map[string]string,
) ([]byte, error)
}
func NewRenderer ¶
func NewRenderer(fc *config.FileConfig) TemplateRenderer
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher watches template files and calls a callback when any change.
func NewWatcher ¶
NewWatcher creates a template file watcher. onChange is called (at most once per event batch) when any watched template changes on disk.
func (*Watcher) WatchWithCallback ¶
WatchWithCallback watches a path with a per-path callback instead of the default onChange. Watches the parent directory to handle atomic saves.