Fixed backup, updated backup docu (#430)

* Fixed backup, updated docu

* reformatted
This commit is contained in:
Kevin Grossmann 2021-06-05 03:27:48 +02:00 committed by GitHub
parent de80516722
commit d126f74d35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 15 deletions

View File

@ -38,16 +38,24 @@ curl -X 'POST' \
"settings": true,
"themes": true
},
"template": [
"templates": [
"recipes.md"
]
}'
```
### wget Example
Download a backup with `wget`
First request a file token with curl:
```bash
wget http://localhost:9000/api/backups/{file_name}/download
curl -X 'GET' \
'http://localhost:9000/api/backups/{file_name}/download' \
-H 'accept: application/json' \
-H 'Content-Type: application/json'
```
Then download the file with wget:
```bash
wget http://localhost:9000/api/utils/download?token={fileToken}
```

View File

@ -9,7 +9,7 @@ from fastapi import HTTPException, status
router = APIRouter(prefix="/api/utils", tags=["Utils"], include_in_schema=True)
@router.get("/download")
@router.get("/download/{token}")
async def download_file(file_path: Optional[Path] = Depends(validate_file_token)):
"""Uses a file token obtained by an active user to retrieve a file from the operating
system."""

View File

@ -52,6 +52,7 @@ class ExportDatabase:
dir.mkdir(parents=True, exist_ok=True)
def export_templates(self, recipe_list: list[BaseModel]):
if self.templates:
for template_path in self.templates:
out_dir = self.templates_dir.joinpath(template_path.name)
out_dir.mkdir(parents=True, exist_ok=True)