build_arq_redis_settings

safir.arq.build_arq_redis_settings(url, password)

Construct Redis settings for arq.

Parameters:
  • url (Url) – Redis DSN.

  • password (SecretStr | None) – Password for the Redis connection.

Returns:

Settings for the arq Redis pool.

Return type:

arq.connections.RedisSettings

Examples

This function is normally used from a property in the application configuration. The application should usually use EnvRedisDsn as the type for the Redis DSN.

from arq.connections import RedisSettings
from pydantic_settings import BaseSettings
from safir.pydantic import EnvRedisDsn

class Config(BaseSettings):
    arq_queue_url: EnvRedisDsn
    arq_queue_password: SecretStr | None

    @property
    def arq_redis_settings(self) -> RedisSettings:
        return build_arq_redis_settings(
            self.arq_queue_url, self_arq_queue_password
        )