config

package
v0.0.0-...-e308f56 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package config loads HCL configuration and uses that to construct the cache backend, and proxy strategies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InjectEnvars

func InjectEnvars(schema *hcl.AST, config *hcl.AST, prefix string, vars map[string]string)

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

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.

func Split

func Split[GlobalConfig any](ast *hcl.AST) (global, providers *hcl.AST)

Split configuration into global config and provider-specific config.

At this point we don't know what config the providers require, so we just pull out the global config and assume everything else is for the providers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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