mirror of
				https://github.com/ijaric/voice_assistant.git
				synced 2025-10-30 23:43:25 +00:00 
			
		
		
		
	[#10] fix import settings
This commit is contained in:
		
							parent
							
								
									5dd8e98a37
								
							
						
					
					
						commit
						60258abce7
					
				|  | @ -3,7 +3,7 @@ import logging | ||||||
| import uvicorn | import uvicorn | ||||||
| 
 | 
 | ||||||
| import lib.app.app as app_module | import lib.app.app as app_module | ||||||
| from lib.app import settings as app_settings | import lib.app.settings as app_settings | ||||||
| 
 | 
 | ||||||
| logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,11 +2,11 @@ import fastapi | ||||||
| from jose import JWTError, jwt | from jose import JWTError, jwt | ||||||
| from pydantic import ValidationError | from pydantic import ValidationError | ||||||
| 
 | 
 | ||||||
|  | import lib.app.settings as app_settings | ||||||
| from lib.api.v1 import schemas as app_schemas | from lib.api.v1 import schemas as app_schemas | ||||||
| from lib.app import settings as app_settings |  | ||||||
| 
 | 
 | ||||||
| app = fastapi.FastAPI() | app = fastapi.FastAPI() | ||||||
| settings = app_settings.get_settings() | settings = app_settings.settings | ||||||
| 
 | 
 | ||||||
| security = fastapi.security.HTTPBearer() | security = fastapi.security.HTTPBearer() | ||||||
| 
 | 
 | ||||||
|  | @ -16,7 +16,7 @@ def get_token_data( | ||||||
| ) -> app_schemas.entity.Token: | ) -> app_schemas.entity.Token: | ||||||
|     token = authorization.credentials |     token = authorization.credentials | ||||||
|     try: |     try: | ||||||
|         secret_key = settings.jwt_secret_key |         secret_key = settings.project.jwt_secret_key | ||||||
|         payload = jwt.decode(token, secret_key, algorithms=["HS256"]) |         payload = jwt.decode(token, secret_key, algorithms=["HS256"]) | ||||||
|         return app_schemas.entity.Token(**payload) |         return app_schemas.entity.Token(**payload) | ||||||
|     except (JWTError, ValidationError): |     except (JWTError, ValidationError): | ||||||
|  |  | ||||||
|  | @ -3,9 +3,9 @@ import typing | ||||||
| from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine | from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine | ||||||
| from sqlalchemy.orm import DeclarativeBase | from sqlalchemy.orm import DeclarativeBase | ||||||
| 
 | 
 | ||||||
| from lib.app import settings as app_settings | import lib.app.settings as app_settings | ||||||
| 
 | 
 | ||||||
| settings = app_settings.get_settings() | settings = app_settings.settings | ||||||
| 
 | 
 | ||||||
| # Создаём базовый класс для будущих моделей | # Создаём базовый класс для будущих моделей | ||||||
| 
 | 
 | ||||||
|  | @ -22,7 +22,7 @@ class AsyncDB: | ||||||
|             f"postgresql+asyncpg://{settings.db.user}:{settings.db.password}" |             f"postgresql+asyncpg://{settings.db.user}:{settings.db.password}" | ||||||
|             f"@{settings.db.host}:{settings.db.port}/{settings.db.name}" |             f"@{settings.db.host}:{settings.db.port}/{settings.db.name}" | ||||||
|         ) |         ) | ||||||
|         self.engine = create_async_engine(self.database_dsn, echo=settings.debug, future=True) |         self.engine = create_async_engine(self.database_dsn, echo=settings.project.debug, future=True) | ||||||
|         self.async_session = async_sessionmaker(self.engine, class_=AsyncSession, expire_on_commit=False) |         self.async_session = async_sessionmaker(self.engine, class_=AsyncSession, expire_on_commit=False) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user