Settings

The runner reads its configuration from environment variables once, when the module is imported, into the settings singleton. The meaning and defaults of every variable are described in Configuration.

class celery_cloud.settings.Settings[source]

Bases: object

Settings class, read once from environment variables.

__init__() → None[source]

Init configuration from environment variables

classmethod get_env_bool(var_name: str, default: bool) → bool[source]

Get an environment variable as bool.

Accepts 1/true/yes/on and 0/false/no/off (case insensitive).

Raises:

ValueError – If the value is not a recognised boolean.

classmethod get_env_int(var_name: str, default: int) → int[source]

Get an environment variable as int.

Raises:

ValueError – If the value is not an integer.

static get_env_variable(var_name: str, default: Any = None) → Any[source]

Get environment variable or default value

Parameters:
  • var_name (str) – Name of the environment variable.

  • default (Any, optional) – Value used when it is not defined.

Raises:

OSError – If the variable is not defined and has no default.

Returns:

The raw value (a str when it comes from the environment).

Return type:

Any