Skip to content

Commit fee33bc

Browse files
committed
docs: the deployment path now selects the production feature set
The warning that nothing passed production to create_app, so webhook loaded in production regardless of the declared lists, described a gap that has been fixed: the module-level app respects FLASK_ENV, whose values map directly onto the config names. The pages now describe the working behaviour, with a line noting the old one for anyone comparing against an earlier checkout.
1 parent 01791cd commit fee33bc

2 files changed

Lines changed: 9 additions & 13 deletions

File tree

architecture/feature_selection.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,10 @@ Under an app created with `config_name="production"`, `env` is `prod`, the loade
204204

205205
Nobody edits a file to make that happen at deploy time. The environment split is a property of the contract itself: the lists describe every environment at once and travel with the source, so the same checkout behaves correctly wherever it is deployed.
206206

207-
{: .warning-title }
208-
> The shipped production entrypoint does not select the `prod` set
207+
{: .note-title }
208+
> How the deployment path selects the set
209209
>
210-
> The mechanism above is real, but nothing in the repository currently activates it. No call site anywhere passes `"production"` to `create_app`, and `docker/entrypoints/production_entrypoint.sh` serves the app with `gunicorn app:app`, which imports the module-level `app = create_app()` at the bottom of `app/__init__.py`. That uses the default `config_name="development"`, so `env` resolves to `dev` and `webhook` is registered in production too.
211-
>
212-
> Setting `FLASK_ENV=production`, as `.env.docker.production.example` does, does not change this. `app/__init__.py` derives `env` from the `config_name` argument and never reads `FLASK_ENV`, and `ConfigManager.load_config` only falls back to `FLASK_ENV` when `config_name` is falsy, which a defaulted `"development"` never is. Treat `features_prod` as a contract that is declared and resolved correctly but not yet reached by the deployment path, and verify what a running instance actually registered rather than assuming.
210+
> The module-level `app = create_app(...)` that gunicorn imports passes `FLASK_ENV` as the config name, and the values in the env examples (`development`, `production`, `testing`) are exactly the names `ConfigManager` accepts. With `FLASK_ENV=production`, as `.env.docker.production.example` sets, `env` resolves to `prod` and the loader reads `features` plus `features_prod`, so `webhook` is not registered. Earlier revisions always built the development config here regardless of environment, which is worth knowing when comparing against an old checkout.
213211
214212
## Verifying what actually loaded
215213

features/features.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,12 @@ features_prod = []
5151

5252
At startup, `app/feature_loader.py` reads these lists and loads the union of `features` and
5353
`features_<env>`, where `env` is `prod` when the app is created with `config_name="production"` and
54-
`dev` otherwise. On paper that keeps `webhook` out of production.
55-
56-
In practice it does not, because nothing in the repository passes `"production"` to `create_app`.
57-
`docker/entrypoints/production_entrypoint.sh` serves the app with `gunicorn app:app`, which imports
58-
the module-level `app = create_app()` at the bottom of `app/__init__.py`. That uses the default
59-
`config_name="development"`, so `env` resolves to `dev` and `webhook` is registered in production
60-
too. See [Feature selection]({{site.baseurl}}/architecture/feature_selection) for the full contract
61-
and the resolved per-environment table.
54+
`dev` otherwise, which keeps `webhook` out of production.
55+
56+
The module-level `app = create_app(...)` that gunicorn imports passes `FLASK_ENV` as the config
57+
name, so with `FLASK_ENV=production` the loader resolves the `prod` set and `webhook` is not
58+
registered. See [Feature selection]({{site.baseurl}}/architecture/feature_selection) for the full
59+
contract and the resolved per-environment table.
6260

6361
A package sitting in `app/features/` that is not named in either list is simply skipped. If neither
6462
list is declared at all, every package found on disk is loaded.

0 commit comments

Comments
 (0)