-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsettings.py
More file actions
63 lines (49 loc) · 1.7 KB
/
settings.py
File metadata and controls
63 lines (49 loc) · 1.7 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from enum import StrEnum
from typing import Annotated
from pydantic import AfterValidator, AnyHttpUrl, Field, PlainValidator, TypeAdapter
from pydantic_settings import BaseSettings, SettingsConfigDict
AnyHttpUrlAdapter = TypeAdapter(AnyHttpUrl)
CustomHttpUrlStr = Annotated[
str,
PlainValidator(AnyHttpUrlAdapter.validate_strings),
AfterValidator(lambda x: str(x).rstrip("/")),
]
class Environment(StrEnum):
"""Possible environments."""
DEV = "dev"
TEST = "test"
PROD = "prod"
class OLTPLogMethod(StrEnum):
NONE = "none"
MANUAL = "manual"
LOGFIRE = "logfire"
LANGFUSE = "langfuse"
class SharedBaseSettings(BaseSettings):
"""Base settings class with common configuration shared across all services."""
ENVIRONMENT: Environment = Field(
default=Environment.DEV,
description="Application environment (dev, test, prod).",
)
OLTP_LOG_METHOD: OLTPLogMethod = Field(
default=OLTPLogMethod.NONE,
description="OpenTelemetry logging method (none, manual, logfire, langfuse).",
)
OTLP_ENDPOINT: CustomHttpUrlStr | None = Field(
default=None,
description="OpenTelemetry GRPC endpoint for OTLP exporter.",
)
OLTP_STD_LOGGING_ENABLED: bool = Field(
default=False,
description="Enable standard logging integration with OpenTelemetry.",
)
HATCHET_WORKER_SLOTS: int = Field(
default=100,
ge=1,
description="Maximum number of concurrent Hatchet workflow slots for a worker.",
)
model_config = SettingsConfigDict(
env_file=".env",
env_file_encoding="utf-8",
extra="ignore",
)
settings = SharedBaseSettings() # type: ignore[call-arg]