n8n/packages/@n8n/task-runner-python/src/config/sentry_config.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
645 B
Python
Raw Normal View History

import os
from dataclasses import dataclass
from src.constants import (
ENV_DEPLOYMENT_NAME,
ENV_ENVIRONMENT,
ENV_N8N_VERSION,
ENV_SENTRY_DSN,
)
@dataclass
class SentryConfig:
dsn: str
n8n_version: str
environment: str
deployment_name: str
@property
def enabled(self) -> bool:
return bool(self.dsn)
@classmethod
def from_env(cls):
return cls(
dsn=os.getenv(ENV_SENTRY_DSN, ""),
n8n_version=os.getenv(ENV_N8N_VERSION, ""),
environment=os.getenv(ENV_ENVIRONMENT, ""),
deployment_name=os.getenv(ENV_DEPLOYMENT_NAME, ""),
)