Skip to content

Configuration

HiveGuard has two configuration layers:

  1. Environment variables — set at startup, require a restart to change
  2. Runtime config — stored in Redis, editable via the dashboard or CLI without restarting

Environment variables

Set these in your .env file or Docker Compose environment.

VariableRequiredDescription
TARGET_URLyesUpstream service to proxy requests to
DATABASE_URLyesPostgreSQL async connection string
SECRET_KEYyesRandom secret for session signing (use at least 32 chars)
DASHBOARD_USERNAMEyesDashboard login username
DASHBOARD_PASSWORDyesDashboard login password
REDIS_URLnoRedis URL (default: redis://redis:6379)
LOG_LEVELnoLogging level: DEBUG, INFO, WARNING, ERROR (default: INFO)

Runtime config

These settings live in Redis and take effect immediately without a restart.

View current config

Terminal window
hiveguard config show

Or via the dashboard: Settings tab.

Change settings

Terminal window
# Risk threshold: minimum score to pass a challenge (0.0–1.0)
hiveguard config set --risk-threshold 0.7
# Consensus threshold: minimum agreement fraction (0.0–1.0)
hiveguard config set --consensus-threshold 0.6
# Proxy timeout: seconds before HiveGuard times out the upstream
hiveguard config set --proxy-timeout 30.0
# Challenge token TTL: seconds a challenge token stays valid
hiveguard config set --challenge-token-ttl 300
# Log level
hiveguard config set --log-level DEBUG

Config reference

KeyTypeDefaultDescription
risk_thresholdfloat0.5Minimum confidence score for a challenge response to pass
consensus_thresholdfloat0.6Fraction of solvers that must agree for a response to count
proxy_timeoutfloat30.0Seconds before timing out the upstream proxy request
challenge_token_ttlint300Seconds a challenge JWT stays valid
log_levelstringINFORuntime log level

Proxy rules

Proxy rules control which paths require a challenge. By default, all proxied paths require a valid challenge token.

Create a rule that skips the challenge for health-check paths:

Terminal window
hiveguard proxy-rules create "/health" --match-type prefix --priority 10

Manage rules via the dashboard (Proxy Rules tab) or CLI (hiveguard proxy-rules).

See Protecting an API for a complete walkthrough.