mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: remove sentry from backend
This commit is contained in:
parent
543f6ea86a
commit
ae63f56645
4 changed files with 2 additions and 60 deletions
|
|
@ -5,12 +5,6 @@ from pydantic import BaseModel
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
|
||||||
class SentryConfig(BaseModel):
|
|
||||||
dsn: str
|
|
||||||
environment: str
|
|
||||||
release: str
|
|
||||||
|
|
||||||
|
|
||||||
class CookieConfig(BaseModel):
|
class CookieConfig(BaseModel):
|
||||||
domain: str
|
domain: str
|
||||||
|
|
||||||
|
|
@ -53,7 +47,6 @@ class HostingConfig(BaseModel):
|
||||||
allowed_origins: list
|
allowed_origins: list
|
||||||
allowed_regexp: str
|
allowed_regexp: str
|
||||||
self_hosted: bool
|
self_hosted: bool
|
||||||
sentry_config: Optional[SentryConfig]
|
|
||||||
cookie_config: CookieConfig
|
cookie_config: CookieConfig
|
||||||
content_delivery: ContentDeliveryConfig
|
content_delivery: ContentDeliveryConfig
|
||||||
|
|
||||||
|
|
@ -150,10 +143,7 @@ def get_learnhouse_config() -> LearnHouseConfig:
|
||||||
env_self_hosted = os.environ.get("LEARNHOUSE_SELF_HOSTED")
|
env_self_hosted = os.environ.get("LEARNHOUSE_SELF_HOSTED")
|
||||||
env_sql_connection_string = os.environ.get("LEARNHOUSE_SQL_CONNECTION_STRING")
|
env_sql_connection_string = os.environ.get("LEARNHOUSE_SQL_CONNECTION_STRING")
|
||||||
|
|
||||||
# Sentry Config
|
|
||||||
env_sentry_dsn = os.environ.get("LEARNHOUSE_SENTRY_DSN")
|
|
||||||
env_sentry_environment = os.environ.get("LEARNHOUSE_SENTRY_ENVIRONMENT")
|
|
||||||
env_sentry_release = os.environ.get("LEARNHOUSE_SENTRY_RELEASE")
|
|
||||||
|
|
||||||
# Fill in values with YAML file if they are not provided
|
# Fill in values with YAML file if they are not provided
|
||||||
site_name = env_site_name or yaml_config.get("site_name")
|
site_name = env_site_name or yaml_config.get("site_name")
|
||||||
|
|
@ -247,33 +237,6 @@ def get_learnhouse_config() -> LearnHouseConfig:
|
||||||
"mailing_config", {}
|
"mailing_config", {}
|
||||||
).get("system_email_adress")
|
).get("system_email_adress")
|
||||||
|
|
||||||
# Sentry config
|
|
||||||
# check if the sentry config is provided in the YAML file
|
|
||||||
sentry_config_verif = (
|
|
||||||
yaml_config.get("hosting_config", {}).get("sentry_config")
|
|
||||||
or env_sentry_dsn
|
|
||||||
or env_sentry_environment
|
|
||||||
or env_sentry_release
|
|
||||||
or None
|
|
||||||
)
|
|
||||||
|
|
||||||
sentry_dsn = env_sentry_dsn or yaml_config.get("hosting_config", {}).get(
|
|
||||||
"sentry_config", {}
|
|
||||||
).get("dsn")
|
|
||||||
sentry_environment = env_sentry_environment or yaml_config.get(
|
|
||||||
"hosting_config", {}
|
|
||||||
).get("sentry_config", {}).get("environment")
|
|
||||||
sentry_release = env_sentry_release or yaml_config.get("hosting_config", {}).get(
|
|
||||||
"sentry_config", {}
|
|
||||||
).get("release")
|
|
||||||
|
|
||||||
if sentry_config_verif:
|
|
||||||
sentry_config = SentryConfig(
|
|
||||||
dsn=sentry_dsn, environment=sentry_environment, release=sentry_release
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
sentry_config = None
|
|
||||||
|
|
||||||
# Payments config
|
# Payments config
|
||||||
env_stripe_secret_key = os.environ.get("LEARNHOUSE_STRIPE_SECRET_KEY")
|
env_stripe_secret_key = os.environ.get("LEARNHOUSE_STRIPE_SECRET_KEY")
|
||||||
env_stripe_publishable_key = os.environ.get("LEARNHOUSE_STRIPE_PUBLISHABLE_KEY")
|
env_stripe_publishable_key = os.environ.get("LEARNHOUSE_STRIPE_PUBLISHABLE_KEY")
|
||||||
|
|
@ -310,7 +273,6 @@ def get_learnhouse_config() -> LearnHouseConfig:
|
||||||
allowed_origins=list(allowed_origins),
|
allowed_origins=list(allowed_origins),
|
||||||
allowed_regexp=allowed_regexp,
|
allowed_regexp=allowed_regexp,
|
||||||
self_hosted=bool(self_hosted),
|
self_hosted=bool(self_hosted),
|
||||||
sentry_config=sentry_config,
|
|
||||||
cookie_config=cookie_config,
|
cookie_config=cookie_config,
|
||||||
content_delivery=content_delivery,
|
content_delivery=content_delivery,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ dependencies = [
|
||||||
"redis>=5.0.7",
|
"redis>=5.0.7",
|
||||||
"requests>=2.32.3",
|
"requests>=2.32.3",
|
||||||
"resend>=2.4.0",
|
"resend>=2.4.0",
|
||||||
"sentry-sdk[fastapi]>=2.13.0",
|
|
||||||
"sqlmodel>=0.0.19",
|
"sqlmodel>=0.0.19",
|
||||||
"tiktoken>=0.7.0",
|
"tiktoken>=0.7.0",
|
||||||
"uvicorn==0.30.1",
|
"uvicorn==0.30.1",
|
||||||
|
|
@ -38,6 +37,7 @@ dependencies = [
|
||||||
"sqlalchemy-utils>=0.41.2",
|
"sqlalchemy-utils>=0.41.2",
|
||||||
"stripe>=11.1.1",
|
"stripe>=11.1.1",
|
||||||
"python-jose>=3.3.0",
|
"python-jose>=3.3.0",
|
||||||
|
"logfire[sqlalchemy]>=3.8.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ from src.core.events.autoinstall import auto_install
|
||||||
from src.core.events.content import check_content_directory
|
from src.core.events.content import check_content_directory
|
||||||
from src.core.events.database import close_database, connect_to_db
|
from src.core.events.database import close_database, connect_to_db
|
||||||
from src.core.events.logs import create_logs_dir
|
from src.core.events.logs import create_logs_dir
|
||||||
from src.core.events.sentry import init_sentry
|
|
||||||
|
|
||||||
|
|
||||||
def startup_app(app: FastAPI) -> Callable:
|
def startup_app(app: FastAPI) -> Callable:
|
||||||
|
|
@ -14,9 +13,6 @@ def startup_app(app: FastAPI) -> Callable:
|
||||||
learnhouse_config: LearnHouseConfig = get_learnhouse_config()
|
learnhouse_config: LearnHouseConfig = get_learnhouse_config()
|
||||||
app.learnhouse_config = learnhouse_config # type: ignore
|
app.learnhouse_config = learnhouse_config # type: ignore
|
||||||
|
|
||||||
# Init Sentry
|
|
||||||
await init_sentry(app)
|
|
||||||
|
|
||||||
# Connect to database
|
# Connect to database
|
||||||
await connect_to_db(app)
|
await connect_to_db(app)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
from fastapi import FastAPI
|
|
||||||
|
|
||||||
import sentry_sdk
|
|
||||||
|
|
||||||
from config.config import LearnHouseConfig
|
|
||||||
|
|
||||||
async def init_sentry(app: FastAPI) -> None:
|
|
||||||
|
|
||||||
learnhouse_config : LearnHouseConfig = app.learnhouse_config # type: ignore
|
|
||||||
if learnhouse_config.hosting_config.sentry_config is not None:
|
|
||||||
sentry_sdk.init(
|
|
||||||
dsn=app.learnhouse_config.hosting_config.sentry_config.dsn, # type: ignore
|
|
||||||
environment=app.learnhouse_config.hosting_config.sentry_config.environment, # type: ignore
|
|
||||||
release=app.learnhouse_config.hosting_config.sentry_config.release, # type: ignore
|
|
||||||
traces_sample_rate=1.0,
|
|
||||||
)
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue