Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
feat(app): support for using app factory.
Browse files Browse the repository at this point in the history
- Changes default `APP_LOC` to `app.main:create_app`.
- Adds `APP_LOC_IS_FACTORY` config, default `True`.

Using a factory makes it a lot easier to monkeypatch configs for testing.
  • Loading branch information
peterschutt committed Nov 16, 2022
1 parent ad2407c commit a176908
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/starlite_saqlalchemy/settings.py
Expand Up @@ -221,7 +221,8 @@ class Config:
env_file = ".env"
env_prefix = "SERVER_"

APP_LOC: str = "app.main:app"
APP_LOC: str = "app.main:create_app"
APP_LOC_IS_FACTORY: bool = True
HOST: str = "localhost"
KEEPALIVE: int = 65
PORT: int = 8000
Expand Down
3 changes: 1 addition & 2 deletions tests/utils/controllers.py
Expand Up @@ -6,8 +6,7 @@
from starlite.status_codes import HTTP_200_OK

from starlite_saqlalchemy.repository.types import FilterTypes

from .domain import Author, CreateDTO, ReadDTO, Service, UpdateDTO
from tests.utils.domain import Author, CreateDTO, ReadDTO, Service, UpdateDTO

DETAIL_ROUTE = "/{author_id:uuid}"

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -44,7 +44,7 @@ commands =
basepython = python3.11
deps =
asyncpg-stubs
mypy==0.982
mypy
types-redis
{[testenv]deps}
commands =
Expand Down

0 comments on commit a176908

Please sign in to comment.