After #45, we should consider whether the rock should support Charmcraft's 12-factor FastAPI framework. It would be nice to use the rock to demonstrate the benefits of the framework when developing a charm.
To support the framework, at minimum we'd need to:
- Call the Pebble service
fastapi - we can do this in #45.
- Rename environment variables from
DEMO_SERVER_DB_* to POSTGRESQL_DB_*.
- Instead of hardcoding the database name, use
os.environ.get("POSTGRESQL_DB_NAME", "names_db"). The framework sets POSTGRESQL_DB_NAME based on the app name.
See https://documentation.ubuntu.com/charmcraft/4.3/reference/extensions/fastapi-framework-extension/
The changes would have downstream impact - primarily the Kubernetes charm tutorial in Ops.
After #45, we should consider whether the rock should support Charmcraft's 12-factor FastAPI framework. It would be nice to use the rock to demonstrate the benefits of the framework when developing a charm.
To support the framework, at minimum we'd need to:
fastapi- we can do this in #45.DEMO_SERVER_DB_*toPOSTGRESQL_DB_*.os.environ.get("POSTGRESQL_DB_NAME", "names_db"). The framework setsPOSTGRESQL_DB_NAMEbased on the app name.See https://documentation.ubuntu.com/charmcraft/4.3/reference/extensions/fastapi-framework-extension/
The changes would have downstream impact - primarily the Kubernetes charm tutorial in Ops.