3. Configuration
halon-bounce-classifier loads settings from environment variables.
You can set the environment variables by using the following command.
# systemctl edit halon-bounce-classifier
You can then add the environment variables you want to configure like below.
[Service]
Environment="PORT=8000"
Environment="HOST=127.0.0.1"
Below are some of the most important environment variables that can be configured.
- PORT
The port that the server will run on. The default is 8080.
- HOST
The IP address that the server will run on. The default is 127.0.0.1.
Note
Use * to listen on any IP, useful when for example running in a container
- SSL_CERTFILE
The path to the certificate. The default is to not use SSL.
- SSL_KEYFILE
The path to the private key. The default is to not use SSL.
- API_KEY
The API key to use. The default is to not use an API key.
3.1. Cache
- HALON_BNAC_CACHE
- Type:
bool
Trueif the cache should be enabled. The default isTrue.
- HALON_BNAC_CACHE_STATS
- Type:
bool
Trueif the cache statistics should be enabled. The default isFalsesince collection statistics has a small performance impact.
- HALON_BNAC_CACHE_FOLDER
- Type:
str
The folder where the cache is stored. The default is
/var/lib/halon/bounce-classifier.
- HALON_BNAC_CACHE_SIZE
- Type:
int
The cache size in bytes. The default is of approximately 100MB.
- HALON_BNAC_CACHE_TIMER
- Type:
bool
Enables timing metrics for cache
getandsetoperations. The default isFalse.When enabled,
/v1/cache/statsreports:timer_enabledastrueavg_get_time_ms: average cache read time in millisecondsavg_set_time_ms: average cache write time in milliseconds
Set
HALON_BNAC_CACHE_TIMER=trueto enable it. Any other value keeps it disabled.
3.2. Batching
- HALON_BNAC_BATCH_SIZE
- Type:
int
Maximum number of queued requests processed together in one server-side batch for batch endpoints (for example
/v1/bnacand/v2/bnac). This does not apply to single-request endpoints such as/v1/bnac/singleand/v2/bnac/single. The default is16.
- HALON_BNAC_BATCH_WAIT_TIME
- Type:
int
Batch flush interval in milliseconds. The default is
100.