diff options
Diffstat (limited to 'takahe')
-rw-r--r-- | takahe/settings.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/takahe/settings.py b/takahe/settings.py index 288ecca..788654d 100644 --- a/takahe/settings.py +++ b/takahe/settings.py @@ -7,12 +7,16 @@ from typing import List, Literal, Optional, Union import dj_database_url import sentry_sdk -from pydantic import AnyUrl, BaseSettings, EmailStr, Field, PostgresDsn, validator +from pydantic import AnyUrl, BaseSettings, EmailStr, Field, validator from sentry_sdk.integrations.django import DjangoIntegration BASE_DIR = Path(__file__).resolve().parent.parent +class ImplicitHostname(AnyUrl): + host_required = False + + class MediaBackendUrl(AnyUrl): host_required = False allowed_schemes = {"s3", "gcs", "local"} @@ -35,11 +39,6 @@ TAKAHE_ENV_FILE = os.environ.get( ) -TAKAHE_ENV_FILE = os.environ.get( - "TAKAHE_ENV_FILE", "test.env" if "pytest" in sys.modules else ".env" -) - - class Settings(BaseSettings): """ Pydantic-powered settings, to provide consistent error messages, strong @@ -47,7 +46,7 @@ class Settings(BaseSettings): """ #: The default database. - DATABASE_SERVER: Optional[PostgresDsn] + DATABASE_SERVER: Optional[ImplicitHostname] #: The currently running environment, used for things such as sentry #: error reporting. @@ -91,6 +90,10 @@ class Settings(BaseSettings): MEDIA_ROOT: str = str(BASE_DIR / "media") MEDIA_BACKEND: Optional[MediaBackendUrl] = None + #: If search features like full text search should be enabled. + #: (placeholder setting, no effect) + SEARCH: bool = True + PGHOST: Optional[str] = None PGPORT: Optional[int] = 5432 PGNAME: str = "takahe" |