We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d194d12 commit 3afdfafCopy full SHA for 3afdfaf
README.md
@@ -193,6 +193,23 @@ user_creator = UserCreator(repository)
193
user_creator.create(fake_user)
194
```
195
196
+### Configuration
197
+
198
+There are multiple ways to configure your classes. A simple approach is to use environment variables on your factory
199
+annotated methods.
200
201
+```python
202
+import os
203
+from quickd import factory
204
205
206
+@factory
207
+def choose_database() -> Database:
208
+ username = os.environ.get("POSTGRES_USER")
209
+ password = os.environ.get("POSTGRES_PASS")
210
+ return PostgreSQL(username, password)
211
+```
212
213
## 🧠 Motivation
214
215
Dependency injection provides a great way to decouple your classes in order to improve testability and maintainability.
0 commit comments