TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tilsor/ModSecIntl_wace_lib/llms.txt
Use this file to discover all available pages before exploring further.
configstore package is responsible for loading, validating, and exposing WACElib’s runtime configuration. It enforces a singleton pattern: only one ConfigStore may exist per process. The package also defines the ModelPluginType enum that controls which portion of an HTTP transaction each model plugin is allowed to process.
ConfigFileData
ConfigFileData is the struct that YAML configuration files unmarshal into. Pass an instance to wace.Init after unmarshalling.
Filesystem path for the WACElib log file. The path must be writable; if the
file does not exist, WACElib attempts to create it during
Init.Log verbosity. Valid values:
"DEBUG", "INFO", "WARN", "ERROR".Ordered list of model plugin configurations. Each entry identifies a
.so
plugin file, its type, weight, execution mode, and optional custom parameters.List of decision plugin configurations.
NATS server address used for async and remote-sync plugins. Defaults to
"localhost:4222" when not set.YAML-to-Go mapping example
ConfigStore
ConfigStore is the runtime representation of the configuration after parsing and validation. Retrieve the singleton with configstore.Get().
Map from model plugin ID to its validated runtime configuration. Populated by
SetConfig; keyed by configFileModelPlugin.ID.Map from decision plugin ID to its validated runtime configuration.
Validated log file path resolved from
ConfigFileData.Logpath.Parsed log level value converted from the
Loglevel string.NATS server URL. Set to
"localhost:4222" if ConfigFileData.NatsURL was
empty.Optional application identifier. Not set by
SetConfig; reserved for
runtime assignment.Functions
New
ConfigStore. Returns an error if a singleton already exists ("ConfigStore: an instance already exists"). Called internally by wace.Init; you do not need to call it directly under normal usage.
Get
ConfigStore. Returns an error if New has not been called yet ("ConfigStore: Configuration was not loaded"). Safe to call from multiple goroutines after wace.Init completes.
Clean
nil, allowing a subsequent New() call to succeed. Intended for use in tests to prevent state leaking between test cases.
IsAsync
true if the model plugin identified by modelID is configured with Mode == "async". Used internally by wace.Analyze to route plugin calls through NATS rather than direct function calls.
A model plugin ID that exists in
ConfigStore.ModelPlugins.ModelPluginType
ModelPluginType is an integer enum that describes which part of an HTTP transaction a model plugin is designed to analyse. It is used as the modelsTypeAsString parameter of wace.Analyze (via its string representation) and as the PluginType field in plugin configuration.
| Constant | String | Description |
|---|---|---|
RequestHeaders | "RequestHeaders" | HTTP request headers only |
RequestBody | "RequestBody" | HTTP request body only |
AllRequest | "AllRequest" | Full HTTP request (headers + body) |
ResponseHeaders | "ResponseHeaders" | HTTP response headers only |
ResponseBody | "ResponseBody" | HTTP response body only |
AllResponse | "AllResponse" | Full HTTP response (headers + body) |
Everything | "Everything" | Any portion of request or response |
StringToPluginType
ModelPluginType constant. Returns an error for unrecognised strings.