runtime

Configuration (marreta.env)

Every MARRETA_* runtime variable: what it does, the values it accepts, and its default.

The runtime reads these MARRETA_* variables from the environment and from marreta.env. Process environment variables override the file, which overrides the built-in defaults. For how to set them locally and in production, see Configure environment variables.

Feature flags use the dynamic pattern MARRETA_FEATURE_<NAME> (see feature). Arbitrary env.* values your own code reads, for example auth secrets, are not listed here.

Server

VariablePurposeAcceptsRequiredDefault
MARRETA_HOSTAddress the server binds to.stringno0.0.0.0
MARRETA_PORTPort the server listens on.integerno8080
MARRETA_CORSEnables CORS.booleannotrue
MARRETA_CORS_ORIGINAllowed CORS origin.stringno*
MARRETA_DOCS_ENABLEDServes the OpenAPI docs.booleannotrue
MARRETA_DOCS_PATHPath the docs are served at.stringno/docs

Runtime

VariablePurposeAcceptsRequiredDefault
MARRETA_LOG_LEVELMinimum log level.debug, info, warn, errornoinfo
MARRETA_REQUEST_LOGLogs each HTTP request.booleannotrue
MARRETA_TRACE_CONTEXTPropagates W3C trace context to outbound calls.booleannotrue
MARRETA_TIMEZONETimezone for local date and time.IANA name (America/Sao_Paulo)noUTC
MARRETA_WORKER_THREADSSize of the runtime thread pool.integernoCPU cores
MARRETA_MAX_RECURSION_DEPTHCaps task recursion depth.integerno500
MARRETA_HTTP_TIMEOUT_MSDefault timeout for http_client requests.integer (ms)no30000
MARRETA_RUNTIME_PROFILEEnables hot-path profiling when set.hot_pathno

Database

A db provider is opt-in: set MARRETA_DB_PROVIDER to enable it. The host, name, and user are then required.

VariablePurposeAcceptsRequiredDefault
MARRETA_DB_PROVIDERSelects the provider and enables db.postgresto use db
MARRETA_DB_HOSTDatabase host.stringyes
MARRETA_DB_PORTDatabase port.integerno5432
MARRETA_DB_NAMEDatabase name.stringyes
MARRETA_DB_USERDatabase user.stringyes
MARRETA_DB_PASSWORDDatabase password.stringno
MARRETA_DB_SSL_MODETLS mode.disable, require, verify-ca, verify-fullno
MARRETA_DB_POOL_MAX_CONNECTIONSMax pool connections.integerno
MARRETA_DB_POOL_MIN_CONNECTIONSMin pool connections.integerno
MARRETA_DB_POOL_ACQUIRE_TIMEOUT_SECSWait for a connection.integer (s)no
MARRETA_DB_POOL_IDLE_TIMEOUT_SECSIdle connection timeout.integer (s)no
MARRETA_DB_POOL_MAX_LIFETIME_SECSMax connection lifetime.integer (s)no
MARRETA_DB_POOL_TEST_BEFORE_ACQUIREValidate a connection before use.booleanno

Document store

A doc provider is opt-in: set MARRETA_DOC_PROVIDER to enable it.

VariablePurposeAcceptsRequiredDefault
MARRETA_DOC_PROVIDERSelects the provider and enables doc.mongodbto use doc
MARRETA_DOC_HOSTDocument store host.stringyes
MARRETA_DOC_PORTDocument store port.integerno27017
MARRETA_DOC_NAMEDatabase name.stringyes
MARRETA_DOC_USERUser.stringyes
MARRETA_DOC_PASSWORDPassword.stringno
MARRETA_DOC_AUTH_SOURCEAuthentication database.stringno
MARRETA_DOC_POOL_MAX_CONNECTIONSMax pool connections.integerno
MARRETA_DOC_POOL_MIN_CONNECTIONSMin pool connections.integerno
MARRETA_DOC_POOL_CONNECT_TIMEOUT_MSConnect timeout.integer (ms)no
MARRETA_DOC_POOL_SERVER_SELECTION_TIMEOUT_MSServer selection timeout.integer (ms)no

Cache

A cache provider is opt-in: set MARRETA_CACHE_PROVIDER to enable it.

VariablePurposeAcceptsRequiredDefault
MARRETA_CACHE_PROVIDERSelects the provider and enables cache.redisto use cache
MARRETA_CACHE_HOSTCache host.stringyes
MARRETA_CACHE_PORTCache port.integerno6379
MARRETA_CACHE_USERUser.stringno
MARRETA_CACHE_PASSWORDPassword.stringno
MARRETA_CACHE_DBDatabase index.integerno
MARRETA_CACHE_PREFIXPrefix added to every key.stringnoempty
MARRETA_CACHE_DEFAULT_TTLDefault TTL when a set omits one.integer (s)no
MARRETA_CACHE_POOL_SIZEConnection pool size.integerno10
MARRETA_CACHE_CONNECT_TIMEOUT_MSConnect timeout.integer (ms)no2000
MARRETA_CACHE_OPERATION_TIMEOUT_MSPer-operation timeout.integer (ms)no1000
MARRETA_CACHE_RECONNECT_MAX_RETRIESReconnect attempts.integerno10

Messaging

A messaging provider is opt-in: set MARRETA_QUEUE_PROVIDER to enable queue and topic.

VariablePurposeAcceptsRequiredDefault
MARRETA_QUEUE_PROVIDERSelects the provider and enables messaging.rabbitmqto use messaging
MARRETA_QUEUE_HOSTBroker host.stringyes
MARRETA_QUEUE_PORTBroker port.integerno5672
MARRETA_QUEUE_USERUser.stringyes
MARRETA_QUEUE_PASSWORDPassword.stringno
MARRETA_QUEUE_VHOSTVirtual host.stringno/
MARRETA_QUEUE_PREFETCHUnacked messages a consumer may hold.integerno10
MARRETA_QUEUE_RECONNECT_MAX_RETRIESReconnect attempts.integerno
MARRETA_TOPIC_EXCHANGEExchange that topics publish to.stringnomarreta.topics

Notes

  • marreta init --with db,cache,doc,queue scaffolds these with local defaults and a docker-compose.yml.
  • Run marreta doctor to check the configured providers are reachable.
  • See Providers for the abstraction behind the provider groups.