validate hardcover api setting #1352

This commit is contained in:
FuzzyGrim
2026-05-23 17:03:16 +02:00
parent 3290c5e48a
commit 00a2467dbd
2 changed files with 6 additions and 1 deletions

View File

@@ -15,7 +15,7 @@ This page outlines the environment variables used in the YamTrack project.
| `IGDB_ID` | IGDB API key for games. A default key is provided, but it's recommended to get your own as it has a low rate limit. |
| `IGDB_SECRET` | IGDB API secret for games. A default value is provided, but it's recommended to get your own as it has a low rate limit. |
| `IGDB_NSFW` | Default to `False`. Set to `True` to include adult content in game searches. |
| `HARDCOVER_API` | Hardcover API key for books. A default key is provided, but it's recommended to get your own as it has a low rate limit. |
| `HARDCOVER_API` | Hardcover API key for books. A default key is provided, but it's recommended to get your own as it has a low rate limit. Custom values must include the `Bearer ` prefix. |
| `COMICVINE_API` | ComicVine API key for comics. A default key is provided, but it's recommended to get your own as it has a low rate limit. |
## Media Import

View File

@@ -18,6 +18,7 @@ from decouple import (
undefined,
)
from django.core.cache import CacheKeyWarning
from django.core.exceptions import ImproperlyConfigured
BASE_URL = config("BASE_URL", default=None)
if BASE_URL:
@@ -424,6 +425,10 @@ HARDCOVER_API = config(
"j4MVAEi_-w2N7DuiMgAxkfVc6RuKd88AHrOyzF5xLyU",
),
)
HARDCOVER_API = HARDCOVER_API.strip()
if not HARDCOVER_API.startswith("Bearer "):
msg = "HARDCOVER_API must start with 'Bearer '."
raise ImproperlyConfigured(msg)
COMICVINE_API = config(
"COMICVINE_API",