Buckets:

download
raw
4.14 kB
from typing import Literal
from pydantic import AnyHttpUrl, Field
from csp_gateway import __version__
try:
from pydantic_settings import BaseSettings
except ImportError:
from pydantic import BaseModel as BaseSettings
__all__ = (
"GatewaySettings",
"Settings",
)
class Settings(BaseSettings):
"""Generic settings for the CSP Gateway."""
model_config = {"case_sensitive": True}
API_STR: str = "/api/v1"
BACKEND_CORS_ORIGINS: list[AnyHttpUrl] = []
TITLE: str = "Gateway"
DESCRIPTION: str = "# Welcome to CSP Gateway API\nContains REST/Websocket interfaces to underlying CSP Gateway engine"
VERSION: str = __version__
AUTHOR: str = ""
EMAIL: str = "example@domain.com"
BIND: str = "0.0.0.0"
PORT: int = 8000
ROOT_PATH: str = Field(
default="",
description="URL path prefix the app is served under when behind a reverse proxy that "
"strips the prefix (e.g. '/watchtower'). Passed to the ASGI server as root_path and used "
"to prefix all server-rendered asset/API URLs so the UI works under a sub-path. Leave "
"empty when served at a domain root.",
)
UI: bool = Field(False, description="Enables ui in the web application")
UI_PROVIDER: Literal["default", "spaday"] = Field(
"spaday",
description="Frontend provider for the UI. 'spaday' serves the spaday-based UI; "
"'default' serves the legacy Perspective/React UI, which requires the bundled "
"Javascript build and is slated for removal.",
)
# UI customization fields that let downstream applications white-label the
# default UI from server-side config alone, without a custom Javascript bundle.
HEADER_LOGO: str | None = Field(
default=None,
description="Header logo image, given as an http(s) URL, a data URI, an absolute "
"URL path, or a local file path (local files are served automatically).",
)
FOOTER_LOGO: str | None = Field(
default=None,
description="Footer logo image, given as an http(s) URL, a data URI, an absolute "
"URL path, or a local file path (local files are served automatically).",
)
CUSTOM_JS: list[str] = Field(
default_factory=list,
description="Custom Javascript files to inject into the UI, given as URLs or local "
"file paths (local files are served automatically). Loaded after the main bundle.",
)
CUSTOM_CSS: list[str] = Field(
default_factory=list,
description="Custom CSS files to inject into the UI, given as URLs or local file "
"paths (local files are served automatically). Loaded after the main stylesheet.",
)
CUSTOM_STATIC_DIR: str | None = Field(
default=None,
description="Local directory served at <root_path>/custom. The entire directory is exposed "
"as public static content (useful for assets like logos, e.g. /custom/logo.svg); its top-level "
"*.js and *.css files are additionally auto-injected into the UI in sorted filename order. Do "
"not point this at a directory containing private files.",
)
# DEPRECATED auth settings
# Historically (csp-gateway <2.5), auth was configured via these two fields
# on Settings. In 2.5+, auth moved onto `MountAPIKeyMiddleware` as module
# fields. Keeping these here (default-None sentinels) lets existing YAML
# configs that set `gateway.settings.AUTHENTICATE` / `gateway.settings.API_KEY`
# continue to validate. The `Gateway` class reads them at `start()` and
# applies them to the middleware with a DeprecationWarning. Remove these
# fields (and the `_apply_legacy_auth_settings()` shim in gateway.py) in a
# future major release.
AUTHENTICATE: bool | None = Field(
default=None,
description="DEPRECATED. Use `MountAPIKeyMiddleware` (set it to None or omit from modules) to disable auth.",
)
API_KEY: str | None = Field(
default=None,
description="DEPRECATED. Set `api_key` on `MountAPIKeyMiddleware` directly.",
)
# Alias
GatewaySettings = Settings

Xet Storage Details

Size:
4.14 kB
·
Xet hash:
906bd7c0fae971cca31ac7ee07262d082ea7c31cf8db82806a424c50ad00941c

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.