Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/update dependencies #780

Merged
merged 4 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/docat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ["3.11"]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '20'
- name: install JavaScript dependencies
working-directory: web
run: yarn install
Expand Down
27 changes: 16 additions & 11 deletions docat/docat/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
:copyright: (c) 2019 by docat, https://github.com/docat-org/docat
:license: MIT, see LICENSE for more details.
"""

import os
import secrets
import shutil
from contextlib import asynccontextmanager
from pathlib import Path
from typing import Optional

Expand All @@ -32,31 +34,34 @@
remove_docs,
)

#: Holds the FastAPI application
app = FastAPI(
title="docat",
description="API for docat, https://github.com/docat-org/docat",
openapi_url="/api/v1/openapi.json",
docs_url="/api/docs",
redoc_url="/api/redoc",
)

DOCAT_STORAGE_PATH = Path(os.getenv("DOCAT_STORAGE_PATH", Path("/var/docat")))
DOCAT_DB_PATH = DOCAT_STORAGE_PATH / DB_PATH
DOCAT_UPLOAD_FOLDER = DOCAT_STORAGE_PATH / UPLOAD_FOLDER


@app.on_event("startup")
def startup_create_folders():
@asynccontextmanager
async def lifespan(_: FastAPI):
# Create the folders if they don't exist
DOCAT_UPLOAD_FOLDER.mkdir(parents=True, exist_ok=True)
yield


def get_db() -> TinyDB:
"""Return the cached TinyDB instance."""
return TinyDB(DOCAT_DB_PATH)


#: Holds the FastAPI application
app = FastAPI(
title="docat",
description="API for docat, https://github.com/docat-org/docat",
openapi_url="/api/v1/openapi.json",
docs_url="/api/docs",
redoc_url="/api/redoc",
lifespan=lifespan,
)


@app.get("/api/projects", response_model=Projects, status_code=status.HTTP_200_OK)
def get_projects(include_hidden: bool = False):
if not DOCAT_UPLOAD_FOLDER.exists():
Expand Down
1 change: 1 addition & 0 deletions docat/docat/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
docat utilities
"""

import hashlib
import os
import shutil
Expand Down
Loading