Skip to main content
The Indicator Service is configured entirely through environment variables. Values are loaded from a .env file at startup (via pydantic-settings) and can be overridden by shell environment variables or Docker Compose’s environment section.

Service

ORIGINS
string
default:"localhost"
Comma-separated list of allowed CORS origins. In production, replace with your actual frontend domain(s). Multiple origins are separated by commas with no spaces.

Database

MONGO_URI
string
default:"mongodb://localhost:27017"
MongoDB connection URI. The Docker Compose stack points this to mongodb://indicators-mongo/indicators, using the named service and database. Update this for external or Atlas-hosted clusters.

Message queue

RABBITMQ_URL
string
default:"amqp://guest:guest@rabbitmq/"
RabbitMQ AMQP connection URL. Includes credentials in the URL. The default uses the built-in guest account, which should be replaced with a dedicated user in production.
RESOURCE_DATA_QUEUE
string
default:"resource_data"
Queue name from which the service consumes incoming data segments. Must match the queue name used by the producing service.
RESOURCE_DELETED_QUEUE
string
default:"resource_deleted"
Queue name from which the service consumes resource deletion events. Must match the queue name used by the producing service.

Cache

REDIS_URL
string
default:"redis://indicators-redis:6379"
Redis connection URL. Defaults to the named Docker service. Update for external Redis instances or clusters.
CACHE_KEY_PREFIX
string
default:"indicator_data:"
Prefix applied to all data cache keys stored in Redis. Changing this effectively invalidates the existing cache without flushing Redis.
CACHE_COUNTER_PREFIX
string
default:"indicator_miss:"
Prefix applied to cache miss counter keys in Redis. Used alongside MISS_THRESHOLD to decide when to populate the full cache.
CACHE_TTL_SECONDS
number
default:"3600"
Time-to-live for cached indicator data, in seconds. Defaults to 1 hour. Reduce this value if data changes frequently.
MISS_COUNTER_TTL
number
default:"90"
Time-to-live for cache miss counter keys, in seconds. Counters that expire before reaching MISS_THRESHOLD are reset, preventing stale miss counts from triggering unnecessary cache population.
MISS_THRESHOLD
number
default:"5"
Number of cache misses recorded before the service triggers a full cache population for the affected resource. Increase this to reduce background population frequency under light traffic.
STATS_CACHE_TTL
number
default:"15"
Time-to-live for cached statistics responses, in seconds. Short by default (15 s) to keep aggregate stats reasonably fresh without hitting MongoDB on every request.

Example .env file

The following is a production-ready example. Replace placeholder values with your actual credentials and hostnames before deploying.
.env
# Service
ORIGINS=https://app.example.com,https://admin.example.com

# Database
MONGO_URI=mongodb://indicators-mongo/indicators

# Message queue
RABBITMQ_URL=amqp://indicators_user:changeme@rabbitmq/
RESOURCE_DATA_QUEUE=resource_data
RESOURCE_DELETED_QUEUE=resource_deleted

# Cache
REDIS_URL=redis://indicators-redis:6379
CACHE_KEY_PREFIX=indicator_data:
CACHE_COUNTER_PREFIX=indicator_miss:
CACHE_TTL_SECONDS=3600
MISS_COUNTER_TTL=90
MISS_THRESHOLD=5
STATS_CACHE_TTL=15

Build docs developers (and LLMs) love