Skip to content

Commit 216fab5

Browse files
committed
Move config
1 parent 9778da4 commit 216fab5

19 files changed

Lines changed: 28 additions & 30 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ relative_files = true
6868
source = ["src"]
6969
omit = [
7070
"**/__init__.py",
71-
"src/app/config/logging_.py",
7271
"src/app/main/**",
7372
"**/health/**",
7473
"**/alembic/**",
@@ -97,14 +96,13 @@ type = "layers"
9796
containers = ["app"]
9897
layers = [
9998
"(main)",
100-
"(config)",
10199
"presentation",
102100
"infrastructure",
103101
"core",
104102
]
105103
ignore_imports = [
106-
"app.infrastructure.persistence_sqla.alembic.env -> app.config.loader",
107-
"app.infrastructure.persistence_sqla.alembic.env -> app.config.settings",
104+
"app.infrastructure.persistence_sqla.alembic.env -> app.main.config.loader",
105+
"app.infrastructure.persistence_sqla.alembic.env -> app.main.config.settings",
108106
]
109107

110108
[[tool.importlinter.contracts]]

src/app/infrastructure/persistence_sqla/alembic/env.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from sqlalchemy.engine import Connection
77
from sqlalchemy.ext.asyncio import async_engine_from_config
88

9-
from app.config.loader import load_postgres_settings
10-
from app.config.settings import PostgresSettings
9+
from app.main.config.loader import load_postgres_settings
10+
from app.main.config.settings import PostgresSettings
1111
from app.infrastructure.persistence_sqla.mappings.all import map_tables
1212
from app.infrastructure.persistence_sqla.registry import mapper_registry
1313

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from pydantic_settings import BaseSettings, SettingsConfigDict
55

6-
from app.config.settings import (
6+
from app.main.config.settings import (
77
AppSettings,
88
CookieSettings,
99
JwtSettings,
@@ -13,7 +13,7 @@
1313
SqlaSettings,
1414
)
1515

16-
BASE_DIR: Final[Path] = Path(__file__).resolve().parents[3]
16+
BASE_DIR: Final[Path] = Path(__file__).resolve().parents[4]
1717
_ENV_FILE: Final[Path] = BASE_DIR.joinpath(".env")
1818
_DEFAULT_CONFIG_DICT: Final[SettingsConfigDict] = SettingsConfigDict(
1919
env_file=_ENV_FILE,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
from pydantic import BaseModel, Field, PostgresDsn
55

6-
from app.config.logging_ import LoggingLevel
76
from app.infrastructure.auth_ctx.jwt_types import JwtAlgorithm
7+
from app.main.config.logging_ import LoggingLevel
88

99

1010
class AppSettings(BaseModel):

src/app/main/ioc/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from dishka import Provider, Scope, provide
22

3-
from app.config.settings import PasswordHasherSettings
43
from app.core.commands.activate_user import ActivateUser
54
from app.core.commands.create_user import CreateUser
65
from app.core.commands.deactivate_user import DeactivateUser
@@ -31,6 +30,7 @@
3130
from app.infrastructure.adapters.sqla_user_reader import SqlaUserReader
3231
from app.infrastructure.adapters.sqla_user_tx_storage import SqlaUserTxStorage
3332
from app.infrastructure.adapters.system_utc_timer import SystemUtcTimer
33+
from app.main.config.settings import PasswordHasherSettings
3434

3535

3636
class CoreProvider(Provider):

src/app/main/ioc/infrastructure.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@
88
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, async_sessionmaker, create_async_engine
99
from starlette.requests import Request
1010

11-
from app.config.settings import (
12-
CookieSettings,
13-
JwtSettings,
14-
PasswordHasherSettings,
15-
PostgresSettings,
16-
SessionSettings,
17-
SqlaSettings,
18-
)
1911
from app.infrastructure.adapters.bcrypt_password_hasher import HasherSemaphore, HasherThreadPoolExecutor
2012
from app.infrastructure.auth_ctx.cookie_manager import CookieManager, CookieName
2113
from app.infrastructure.auth_ctx.handlers.change_password import ChangePassword
@@ -29,6 +21,14 @@
2921
from app.infrastructure.auth_ctx.sqla_user_tx_storage import AuthSqlaUserTxStorage
3022
from app.infrastructure.auth_ctx.types_ import AuthAsyncSession
3123
from app.infrastructure.auth_ctx.utc_timer import AuthSessionUtcTimer
24+
from app.main.config.settings import (
25+
CookieSettings,
26+
JwtSettings,
27+
PasswordHasherSettings,
28+
PostgresSettings,
29+
SessionSettings,
30+
SqlaSettings,
31+
)
3232

3333
logger = logging.getLogger(__name__)
3434

src/app/main/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
from dishka.integrations.fastapi import setup_dishka
66
from fastapi import FastAPI
77

8-
from app.config.loader import (
8+
from app.infrastructure.persistence_sqla.mappings.all import map_tables
9+
from app.main.config.loader import (
910
load_app_settings,
1011
load_cookie_settings,
1112
load_jwt_settings,
@@ -14,7 +15,7 @@
1415
load_session_settings,
1516
load_sqla_settings,
1617
)
17-
from app.config.settings import (
18+
from app.main.config.settings import (
1819
AppSettings,
1920
CookieSettings,
2021
JwtSettings,
@@ -23,7 +24,6 @@
2324
SessionSettings,
2425
SqlaSettings,
2526
)
26-
from app.infrastructure.persistence_sqla.mappings.all import map_tables
2727
from app.main.ioc.provider_registry import get_providers
2828
from app.main.setup import setup_global_exception_handlers, setup_logging, setup_middlewares
2929
from app.presentation.http.root_router import make_fastapi_root_router

src/app/main/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from fastapi import FastAPI
44

5-
from app.config.logging_ import DATEFMT, FMT, LoggingLevel
6-
from app.config.settings import CookieSettings
5+
from app.main.config.logging_ import DATEFMT, FMT, LoggingLevel
6+
from app.main.config.settings import CookieSettings
77
from app.presentation.http.auth_cookie_middleware import AuthCookieMiddleware
88

99
logger = logging.getLogger(__name__)

0 commit comments

Comments
 (0)