-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.py
40 lines (29 loc) · 1.38 KB
/
settings.py
1
2
3
4
5
6
7
8
9
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
"""This module defines the application-wide settings."""
from __future__ import annotations
from pathlib import Path
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
"""
A class that defines the application settings.
Settings are automatically loaded from .env files and environment variables. The load order is:
1. the default values here in the code
2. .env, and then
3. the system's environment variables.
"""
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", env_nested_delimiter="__")
# Paths
pycpt_home: Path = Path(__file__).parent
pycpt_artefacts: Path = Path(pycpt_home, "../cpt_artefacts").resolve()
sla_tables: Path = Path(pycpt_home, "sla_tables")
data: Path = Path(pycpt_artefacts, "data")
# test data is in the repo
test_data: Path = Path(pycpt_home, "tests", "data")
test_output: Path = Path(pycpt_home, "tests", "output")
prometheus_report_folder: Path = Path(pycpt_artefacts, "prometheus")
# keep trailing `/`
prometheus_url: str = "http://localhost:9090/"
# Prometheus
time_delta_hours: float = 1 # time delta from now in hours for timeseries queries
step_sec: float = 30 # prometheus sample step in sec
# singleton instance of the Settings class. Use this instead of creating your own instance.
settings = Settings()