Redis Configuration

Warning

monetr is migrating away from using this configuration to a new config layout, this configuration will continue to work for the next few releases but will eventually break and default to an in memory cache setup. If you're setup requires a shared cache server then please add the new cache block to your configuration file. If your setup does not require a shared cache server then no action is required from you, and monetr will simply default to the in memory cache in an upcoming release.

monetr can use any cache that is compatible with Redis's wire protocol. In the provided Docker compose file, local development environment as well as in production valkey is used.

monetr only caches a few things, and for self-hosting it may not even be necessary to run a dedicated cache at this time as monetr also leverages miniredis when a cache server has not been configured. For a single monetr server this embedded "Redis" is sufficient.

To configure a dedicated cache server though:

config.yaml
redis:
  enabled: <true|false> # If this is set to false then miniredis is used.
  address: "localhost"
  port: 6379
  database: 0
  username: ""
  password: ""
  tls: false
  insecureSkipVerify: false
  caCertificatePath: "</tls/ca.cert>"
  keyPath: "</tls/tls.key>"
  certificatePath: "</tls/tls.cert>"
NameTypeDefaultDescription
enabledBooleanfalseEnable a dedicated cache server, if this is set to false then an embedded miniredis instance is used instead.
addressStringThe IP, or DNS resolvable address of your Redis-compatible cache server.
portNumber6379Port that the Redis-compatible cache server can be reached at.
databaseNumber0Database number that you want monetr to use for caching. Defaults to 0.
usernameStringUsername used to authenticate to the Redis-compatible server, defaults to an empty string.
passwordStringPassword used to authenticate to the Redis-compatible server, defaults to an empty string.
tlsBooleanfalseIf true then monetr will connect to the cache server using TLS. TLS is also used if any of the certificate paths below are provided.
insecureSkipVerifyBooleanfalseIf you are using TLS with the cache server but are not distributing a certificate authority file, then you may need to skip TLS verification.
caCertificatePathStringPath to the certificate authority certificate file. If you are verifying your TLS connection then this is required or the server certificate must be among the hosts certificate authorities already.
keyPathStringPath to the client TLS key that monetr should use to connect to the cache server.
certificatePathStringPath to the client TLS certificate that monetr should use to connect to the cache server.
Info

monetr watches the certificate files for changes, so certificates can be rotated without restarting the server. New connections to the cache server will use the new certificates right away. The TLS settings are ignored when enabled is false.

The following environment variables map to the following configuration file fields. Each field is documented below.

VariableConfig File Field
MONETR_REDIS_ENABLEDredis.enabled
MONETR_REDIS_ADDRESSredis.address
MONETR_REDIS_PORTredis.port
MONETR_REDIS_DATABASEredis.database
MONETR_REDIS_USERNAMEredis.username
MONETR_REDIS_PASSWORDredis.password
MONETR_REDIS_TLSredis.tls
MONETR_REDIS_INSECURE_SKIP_VERIFYredis.insecureSkipVerify
MONETR_REDIS_CA_PATHredis.caCertificatePath
MONETR_REDIS_KEY_PATHredis.keyPath
MONETR_REDIS_CERT_PATHredis.certificatePath