Manifest Settings
The settings module provides access to Bender manifest configuration values and dependency connections. It abstracts the complexity of reading from environment variables, parsing database URLs, and maintaining connection pools.
Configuration Access
Access configuration values defined in your application.json manifest using get_configuration(). The function validates that the requested configuration is declared in the manifest and returns the value with appropriate type conversion.
Environment helpers provide standardized access to common deployment values:
get_environment(): ReturnsENVIRONMENTorDATADOG_ENVget_version(): ReturnsVERSIONorDD_VERSION(defaults to"local_dev")get_service_name(): Generates service name for Datadog APM
Database Connections
Redis: Connections are cached internally to avoid creating duplicates. Use get_redis_instance() for synchronous access (Django, workers) and get_async_redis_instance() for async access (FastAPI). Connection pools are created on first access and reused for subsequent calls.
PostgreSQL: Generate Django database configuration automatically with get_django_databases(). It reads database dependencies from the manifest, detects PostGIS extensions, and sets appropriate connection pool settings.
application_kit.settings
get_redis_instance_and_extras
get_redis_instance_and_extras(dependency_name)
Returns a redis instance for the dependency name.
Source code in application_kit/settings.py
26 27 28 29 30 31 32 33 34 35 36 | |
get_redis_instance
get_redis_instance(dependency_name)
Returns a redis instance from the dependency named dependency_name
Source code in application_kit/settings.py
53 54 55 56 57 58 | |
get_configuration
get_configuration(configuration_name)
Returns the configuration value.
Source code in application_kit/settings.py
61 62 63 | |
get_service_url
get_service_url(service_name, path=None)
Returns the service URL for service_name.
Source code in application_kit/settings.py
66 67 68 69 70 71 | |
get_django_databases
get_django_databases()
Returns a django database dict.
Source code in application_kit/settings.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
get_database_url
get_database_url(name)
Returns a BenderDbUrl for the database dependency named name.
Source code in application_kit/settings.py
96 97 98 99 | |
get_version
get_version()
Returns the current version.
Source code in application_kit/settings.py
115 116 117 118 119 | |
get_environment
get_environment()
Returns the current Environment.
Source code in application_kit/settings.py
122 123 124 125 126 | |
get_service_name
get_service_name(worker_name)
Returns the current service name, or optionally worker name.
Source code in application_kit/settings.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
get_async_redis_instance_and_extras
get_async_redis_instance_and_extras(dependency_name)
Returns a redis instance for the dependency name.
Source code in application_kit/settings.py
181 182 183 184 185 186 187 188 189 190 191 192 193 | |