Configuration management for the load balancer. Handles configuration data structures, validation, and persistence.
Configuration management for the load balancer. Handles configuration data structures, validation, and persistence.
(add-proxy config proxy-config)Add a new proxy configuration.
Add a new proxy configuration.
(add-source-route-to-proxy config proxy-name source-route)Add a source route to a proxy. source-route can be a SourceRoute record or a map with :source and :target/:targets.
Add a source route to a proxy. source-route can be a SourceRoute record or a map with :source and :target/:targets.
(compute-cumulative-weights targets)Compute cumulative weights from a sequence of WeightedTarget records. Example: targets with weights [50, 30, 20] -> cumulative [50, 80, 100]
Compute cumulative weights from a sequence of WeightedTarget records. Example: targets with weights [50, 30, 20] -> cumulative [50, 80, 100]
(config->map config)Convert parsed Config back to plain EDN map.
Convert parsed Config back to plain EDN map.
(format-config config)Format full configuration for display.
Format full configuration for display.
(format-proxy proxy)Format a proxy configuration for display.
Format a proxy configuration for display.
(format-target-group tg)Format a TargetGroup for display.
Format a TargetGroup for display.
(get-proxy config proxy-name)Get a proxy configuration by name.
Get a proxy configuration by name.
(health-check->map hc)Convert a HealthCheckConfig back to EDN format.
Convert a HealthCheckConfig back to EDN format.
(load-config-file path)Load configuration from an EDN file.
Load configuration from an EDN file.
(make-simple-config {:keys [name interface port target-ip target-port
stats-enabled health-check-enabled]
:or {name "default"
interface "eth0"
port 80
target-ip "127.0.0.1"
target-port 8080
stats-enabled false
health-check-enabled false}})Create a simple single-proxy configuration. Useful for quick testing or simple deployments.
Create a simple single-proxy configuration. Useful for quick testing or simple deployments.
(make-single-target-group ip port)(make-single-target-group ip port health-check)Create a TargetGroup with a single target. Convenience function for simple configurations.
Create a TargetGroup with a single target. Convenience function for simple configurations.
(make-weighted-target-group targets)Create a TargetGroup with multiple weighted targets. targets should be a sequence of {:ip :port :weight :health-check} maps. Validates that weights sum to 100.
Create a TargetGroup with multiple weighted targets.
targets should be a sequence of {:ip :port :weight :health-check} maps.
Validates that weights sum to 100.(parse-config {:keys [proxies settings]})Parse full configuration from EDN map.
Parse full configuration from EDN map.
(parse-health-check-config health-check-map global-defaults)Parse health check configuration, merging with defaults.
Parse health check configuration, merging with defaults.
(parse-listen {:keys [interfaces port]})Parse listen configuration.
Parse listen configuration.
(parse-proxy-config {:keys [name listen default-target source-routes]})Parse a single proxy configuration.
Parse a single proxy configuration.
(parse-settings settings)Parse settings with defaults.
Parse settings with defaults.
(parse-source-route {:keys [source target targets]} proxy-name)Parse a source route, resolving hostname if necessary. Supports both :target (single) and :targets (weighted array) formats.
Parse a source route, resolving hostname if necessary. Supports both :target (single) and :targets (weighted array) formats.
(parse-target {:keys [ip port]})Parse a single target map to Target record with resolved IP. Kept for backward compatibility.
Parse a single target map to Target record with resolved IP. Kept for backward compatibility.
(parse-target-group target-spec context-msg)Parse a target specification into a TargetGroup. Accepts either a single target map or a vector of targets. Validates weights for multi-target groups.
Parse a target specification into a TargetGroup. Accepts either a single target map or a vector of targets. Validates weights for multi-target groups.
(parse-weighted-target target-map)(parse-weighted-target {:keys [ip port weight health-check]}
global-health-defaults)Parse a target map to WeightedTarget record with resolved IP. If weight is not specified, defaults to 100 (for single target scenarios). global-health-defaults: optional global health check defaults from settings.
Parse a target map to WeightedTarget record with resolved IP. If weight is not specified, defaults to 100 (for single target scenarios). global-health-defaults: optional global health check defaults from settings.
(remove-proxy config proxy-name)Remove a proxy configuration by name.
Remove a proxy configuration by name.
(remove-source-route-from-proxy config proxy-name source-ip prefix-len)Remove a source route from a proxy by source IP/prefix.
Remove a source route from a proxy by source IP/prefix.
(save-config-file config path)Save configuration to an EDN file.
Save configuration to an EDN file.
(target-group->map tg)Convert a TargetGroup back to EDN format. Returns a single target map if only one target, otherwise a vector.
Convert a TargetGroup back to EDN format. Returns a single target map if only one target, otherwise a vector.
(update-proxy config proxy-name update-fn)Update a proxy configuration by name.
Update a proxy configuration by name.
(update-settings config new-settings)Update global settings.
Update global settings.
(validate-config config-map)Validate configuration map against spec. Returns {:valid true :config <parsed>} or {:valid false :errors <explain-data>}
Validate configuration map against spec.
Returns {:valid true :config <parsed>} or {:valid false :errors <explain-data>}(validate-proxy-config proxy-map)Validate a single proxy configuration.
Validate a single proxy configuration.
(validate-target-weights! targets context-msg)Validate weights for targets, throwing on error. context-msg should describe where the targets are (e.g., 'proxy web default-target')
Validate weights for targets, throwing on error. context-msg should describe where the targets are (e.g., 'proxy web default-target')
(validate-weights targets)Validate weights for a group of targets. Returns nil if valid, error message string if invalid.
Rules:
Validate weights for a group of targets. Returns nil if valid, error message string if invalid. Rules: - Single target: weight is optional and ignored - Multiple targets: all must have explicit weights that sum to 100
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |