Skip to content

Configuration and environment variables

Explorer is controlled by a number of environment variables. These are defined in sdss_explorer.utils.config.

Application settings. Places everything that is set by an envvar under a namespace.

Settings #

Bases: BaseSettings

Global settings for webapp, defined by environment variables

Source code in src/sdss_explorer/util/config.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
class Settings(BaseSettings):
    """Global settings for webapp, defined by environment variables"""

    model_config = SettingsConfigDict(env_prefix="explorer_")
    nworkers: int = Field(
        default=2, description="How many gunicorn/uvicorn workers to run with."
    )

    nprocesses: int = Field(
        default=2,
        description="How many export processes to run concurrently. The max possible will on memory spec of the machine.",
    )

    home: str = Field(
        default=os.path.expanduser("~"),
        validation_alias="VAEX_HOME",
        description="The home directory for caching and fingerprinting by vaex. Defaults to `$HOME`.",
    )

    logpath: str = Field(
        default=os.path.expanduser("~"),
        description="The home directory for logs. Defaults to `$HOME`.",
    )

    loglevel: str = Field(
        default="INFO", description="The log level for stdout/err. Defaults to INFO."
    )

    datapath: str = Field(
        default="./home",
        description="The datapath to explorer files. Expects to be formatted in `./[release]/[explorer|columns]All[datatype]-[vastra].[hdf5|parquet]`",
    )

    scratch: str = Field(
        default="./scratch",
        description="The datapath to a scratch space for custom summary file outputs.",
    )

    dev: bool = Field(
        default=False,
        description="Whether to consider the environment a development one or not. Also checks against whether server instance is production for dashboard.",
    )

    vastra: str = Field(
        default="0.6.0",
        validation_alias="VASTRA",
        description="Astra reduction versions to read.",
    )

    release_map: Dict[str, str] = Field(
        default_factory=lambda: {
            "ipl3": "0.6.0",
            "dr19": "0.6.0",
            "dr20": "0.8.1",
        },
        validation_alias="RELEASE_MAP",
        description="Mapping of release name to Astra reduction version.",
    )

    solara: bool = Field(
        default=False,
        validation_alias="EXPLORER_MOUNT_DASHBOARD",
        description="Whether to mount the dashboard in the FastAPI server instance.",
    )

    api_url: str = Field(
        default="http://localhost:8050",
        description="API url for download server. Defaults to localhost on port 8050.",
    )

    download_url: str = Field(
        default="https://bing.com/search?query=",
        description="Public download URL for serving files. Defaults to bing (for fun).",
    )