hynek / svcs

A Flexible Service Locator for Python.
https://svcs.hynek.me
MIT License
294 stars 19 forks source link

Use flask app.extensions for storing registry #73

Closed alexrudy closed 7 months ago

alexrudy commented 7 months ago

Summary

As discussed in #71 and #72, move registry from app.config to app.extensions

Flask provides app.extensions as a specific place for extensions to store state, and many flask extensions do that (e.g. Flask-SQLAlchemy). This seems like the right place to store svcs state.

app.config is usually filled with things which might be set from an external config.py file, environment variable, or some other source. I often even like to be able to render these things back to e.g. JSON to save the current configuration for debugging.

Pull Request Check List