Documentation
¶
Overview ¶
Package config loads HCL configuration and uses that to construct the cache backend, and proxy strategies.
Index ¶
- func InjectEnvars(schema *hcl.AST, config *hcl.AST, prefix string, vars map[string]string)
- func Load(ctx context.Context, cr *cache.Registry, mr *metadatadb.Registry, ...) (http.Handler, metadatadb.Backend, error)
- func Schema[GlobalConfig any](cr *cache.Registry, mr *metadatadb.Registry, sr *strategy.Registry) *hcl.AST
- func Split[GlobalConfig any](ast *hcl.AST) (global, providers *hcl.AST)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InjectEnvars ¶
InjectEnvars walks the schema and for each attribute not present in the config, checks for a corresponding environment variable and injects it.
Environment variable names are derived from the path to the attribute: prefix + block names + attr name, joined with "_", uppercased, hyphens replaced with "_". e.g. prefix="CACHEW", path=["scheduler", "concurrency"] -> "CACHEW_SCHEDULER_CONCURRENCY".
func Load ¶
func Load( ctx context.Context, cr *cache.Registry, mr *metadatadb.Registry, sr *strategy.Registry, ast *hcl.AST, mux *http.ServeMux, vars map[string]string, ) (http.Handler, metadatadb.Backend, error)
Load HCL configuration and use that to construct the cache backend, and proxy strategies. It returns an http.Handler that wraps mux — any loaded strategies that implement strategy.Interceptor are applied as middleware before ServeMux route matching, so that they can inspect r.RequestURI rather than the path-only r.URL.Path.
func Schema ¶
func Schema[GlobalConfig any](cr *cache.Registry, mr *metadatadb.Registry, sr *strategy.Registry) *hcl.AST
Schema returns the configuration file schema.
Types ¶
This section is empty.