mirror of
https://github.com/flibusta-apps/telegram_files_server.git
synced 2025-12-06 04:25:38 +01:00
Use uvloop
This commit is contained in:
@@ -2,18 +2,17 @@ exclude: 'docs|node_modules|migrations|.git|.tox'
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/ambv/black
|
||||
rev: 22.12.0
|
||||
rev: 23.3.0
|
||||
hooks:
|
||||
- id: black
|
||||
language_version: python3.11
|
||||
|
||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||
rev: 'v0.0.216'
|
||||
rev: 'v0.0.267'
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: ["--force-exclude"]
|
||||
|
||||
- repo: https://github.com/crate-ci/typos
|
||||
rev: v1.13.6
|
||||
rev: typos-dict-v0.9.26
|
||||
hooks:
|
||||
- id: typos
|
||||
|
||||
@@ -9,6 +9,7 @@ from app.serializers import CreateUploadedFile, UploadedFile
|
||||
from app.services.file_downloader import FileDownloader
|
||||
from app.services.file_uploader import FileUploader
|
||||
|
||||
|
||||
router = APIRouter(
|
||||
prefix="/api/v1/files", dependencies=[Depends(check_token)], tags=["files"]
|
||||
)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.responses import ORJSONResponse
|
||||
|
||||
from prometheus_fastapi_instrumentator import Instrumentator
|
||||
import sentry_sdk
|
||||
|
||||
@@ -8,6 +9,7 @@ from app.views import healthcheck_router, router
|
||||
from core.config import env_config
|
||||
from core.db import database
|
||||
|
||||
|
||||
sentry_sdk.init(
|
||||
env_config.SENTRY_DSN,
|
||||
)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from fastapi.security import APIKeyHeader
|
||||
|
||||
|
||||
default_security = APIKeyHeader(name="Authorization")
|
||||
|
||||
@@ -2,6 +2,7 @@ from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, BaseSettings
|
||||
|
||||
|
||||
BotToken = str
|
||||
TelethonSessionName = str
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ from sqlalchemy import MetaData
|
||||
|
||||
from core.config import env_config
|
||||
|
||||
|
||||
DATABASE_URL = (
|
||||
f"postgresql://{env_config.POSTGRES_USER}:{quote(env_config.POSTGRES_PASSWORD)}@"
|
||||
f"{env_config.POSTGRES_HOST}:{env_config.POSTGRES_PORT}/{env_config.POSTGRES_DB}"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from core.app import start_app
|
||||
|
||||
|
||||
app = start_app()
|
||||
|
||||
@@ -65,14 +65,13 @@ max-complexity = 15
|
||||
[tool.ruff.isort]
|
||||
known-first-party = ["core", "app"]
|
||||
force-sort-within-sections = true
|
||||
force-wrap-aliases = true
|
||||
section-order = ["future", "standard-library", "base_framework", "framework_ext", "third-party", "first-party", "local-folder"]
|
||||
lines-after-imports = 2
|
||||
|
||||
# only_sections = true
|
||||
# force_sort_within_sections = true
|
||||
# lines_after_imports = 2
|
||||
# lexicographical = true
|
||||
# sections = ["FUTURE", "STDLIB", "BASEFRAMEWORK", "FRAMEWORKEXT", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
|
||||
# known_baseframework = ["fastapi",]
|
||||
# known_frameworkext = ["starlette",]
|
||||
[tool.ruff.isort.sections]
|
||||
base_framework = ["fastapi",]
|
||||
framework_ext = ["starlette"]
|
||||
|
||||
[tool.ruff.pyupgrade]
|
||||
keep-runtime-typing = true
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import httpx
|
||||
|
||||
|
||||
response = httpx.get("http://localhost:8080/healthcheck")
|
||||
print(f"HEALTHCHECK STATUS: {response.status_code}")
|
||||
exit(0 if response.status_code == 200 else 1)
|
||||
|
||||
@@ -4,4 +4,4 @@ rm -rf prometheus
|
||||
mkdir prometheus
|
||||
|
||||
alembic -c ./app/alembic.ini upgrade head
|
||||
uvicorn main:app --host 0.0.0.0 --port 8080
|
||||
uvicorn main:app --host 0.0.0.0 --port 8080 --loop uvloop
|
||||
|
||||
Reference in New Issue
Block a user