update settings

This commit is contained in:
IluaAir
2025-07-06 01:07:25 +03:00
parent 1a45e2c284
commit ef38c45f14
4 changed files with 70 additions and 3 deletions

38
poetry.lock generated
View File

@@ -309,6 +309,24 @@ files = [
{file = "markupsafe-3.0.2.tar.gz", hash = "sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0"},
]
[[package]]
name = "passlib"
version = "1.7.4"
description = "comprehensive password hashing framework supporting over 30 schemes"
optional = false
python-versions = "*"
groups = ["main"]
files = [
{file = "passlib-1.7.4-py2.py3-none-any.whl", hash = "sha256:aa6bca462b8d8bda89c70b382f0c298a20b5560af6cbfa2dce410c0a2fb669f1"},
{file = "passlib-1.7.4.tar.gz", hash = "sha256:defd50f72b65c5402ab2c573830a6978e5f202ad0d984793c8dde2c4152ebe04"},
]
[package.extras]
argon2 = ["argon2-cffi (>=18.2.0)"]
bcrypt = ["bcrypt (>=3.1.0)"]
build-docs = ["cloud-sptheme (>=1.10.1)", "sphinx (>=1.6)", "sphinxcontrib-fulltoc (>=1.2.0)"]
totp = ["cryptography"]
[[package]]
name = "pydantic"
version = "2.11.7"
@@ -467,6 +485,24 @@ gcp-secret-manager = ["google-cloud-secret-manager (>=2.23.1)"]
toml = ["tomli (>=2.0.1)"]
yaml = ["pyyaml (>=6.0.1)"]
[[package]]
name = "pyjwt"
version = "2.10.1"
description = "JSON Web Token implementation in Python"
optional = false
python-versions = ">=3.9"
groups = ["main"]
files = [
{file = "PyJWT-2.10.1-py3-none-any.whl", hash = "sha256:dcdd193e30abefd5debf142f9adfcdd2b58004e644f25406ffaebd50bd98dacb"},
{file = "pyjwt-2.10.1.tar.gz", hash = "sha256:3cc5772eb20009233caf06e9d8a0577824723b44e6648ee0a2aedb6cf9381953"},
]
[package.extras]
crypto = ["cryptography (>=3.4.0)"]
dev = ["coverage[toml] (==5.0.4)", "cryptography (>=3.4.0)", "pre-commit", "pytest (>=6.0.0,<7.0.0)", "sphinx", "sphinx-rtd-theme", "zope.interface"]
docs = ["sphinx", "sphinx-rtd-theme", "zope.interface"]
tests = ["coverage[toml] (==5.0.4)", "pytest (>=6.0.0,<7.0.0)"]
[[package]]
name = "python-dotenv"
version = "1.1.0"
@@ -685,4 +721,4 @@ standard = ["colorama (>=0.4) ; sys_platform == \"win32\"", "httptools (>=0.6.3)
[metadata]
lock-version = "2.1"
python-versions = ">=3.12"
content-hash = "6a34c561f6d89bbd59cd3a5039aa854bd32ff1717a43be499121c5282fdde885"
content-hash = "e9bc371ef3ba3a59fce2dbc0416fbb5be92bbccf98f36bd661ed55318975f3a1"

View File

@@ -19,6 +19,8 @@ dependencies = [
"pydantic (>=2.11.7,<3.0.0)",
"idna (>=3.10,<4.0)",
"fastapi (>=0.115.14,<0.116.0)",
"pyjwt (>=2.10.1,<3.0.0)",
"passlib (>=1.7.4,<2.0.0)",
]

View File

@@ -1,6 +1,10 @@
import sys
import uvicorn
from pathlib import Path
from fastapi import FastAPI
sys.path.append(str(Path(__file__).parent.parent))
from src.api import router
app = FastAPI()

View File

@@ -1,5 +1,30 @@
from pydantic_settings import BaseSettings
from pathlib import Path
from pydantic import BaseModel
from pydantic_settings import BaseSettings, SettingsConfigDict
BASE_DIR = Path(__file__).parent
DB_PATH = BASE_DIR / "db/taskncoffee.db"
class DbSettings(BaseModel):
url: str = f"sqlite+aiosqlite:///{DB_PATH}"
class AccessToken(BaseSettings):
model_config = SettingsConfigDict(env_file='.env',
env_file_encoding='utf-8',
env_prefix="ACCESS_TOKEN_"
)
expire_minutes: int = 15
secret_key: str
algorithm: str = "HS256"
class Settings(BaseSettings):
...
model_config = SettingsConfigDict(env_file='.env', env_file_encoding='utf-8')
db: DbSettings = DbSettings()
access_token: AccessToken = AccessToken()
settings = Settings()