Skip to content

Commit

Permalink
Merge pull request #780 from docat-org/chore/update-deps
Browse files Browse the repository at this point in the history
Chore/update dependencies
  • Loading branch information
reglim authored Jan 30, 2024
2 parents ea383fe + 0aab9bc commit 859743a
Show file tree
Hide file tree
Showing 5 changed files with 1,854 additions and 1,593 deletions.
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

0 comments on commit 859743a

Please sign in to comment.