"""Configuration management for NS Trains MCP Server."""
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
"""Application settings loaded from environment variables."""
# NS API Configuration
ns_api_key: str
ns_api_base_url: str = "https://gateway.apiportal.ns.nl"
# Environment
environment: str = "production"
model_config = SettingsConfigDict(
env_file=".env",
env_file_encoding="utf-8",
case_sensitive=False,
extra="ignore",
)
@property
def is_development(self) -> bool:
"""Check if running in development mode."""
return self.environment.lower() == "development"
# Singleton instance
_settings: Settings | None = None
def get_settings() -> Settings:
"""Get or create the settings instance."""
global _settings # noqa: PLW0603
if _settings is None:
_settings = Settings() # type: ignore[call-arg]
return _settings