feat: use MailGun instead of Resend

This commit is contained in:
rzmk 2025-07-03 19:01:24 -04:00
parent 5fd979b2a2
commit 3b60ec5547
9 changed files with 1628 additions and 54 deletions

View file

@ -20,8 +20,8 @@ class SecurityConfig(BaseModel):
class ChromaDBConfig(BaseModel):
isSeparateDatabaseEnabled: bool | None
db_host: str | None
isSeparateDatabaseEnabled: bool | None
db_host: str | None
class AIConfig(BaseModel):
@ -53,7 +53,8 @@ class HostingConfig(BaseModel):
class MailingConfig(BaseModel):
resend_api_key: str
mailgun_api_key: str
mailgun_domain: str
system_email_address: str
@ -151,7 +152,7 @@ def get_learnhouse_config() -> LearnHouseConfig:
env_self_hosted = os.environ.get("LEARNHOUSE_SELF_HOSTED")
env_sql_connection_string = os.environ.get("LEARNHOUSE_SQL_CONNECTION_STRING")
# Fill in values with YAML file if they are not provided
site_name = env_site_name or yaml_config.get("site_name")
@ -236,10 +237,14 @@ def get_learnhouse_config() -> LearnHouseConfig:
).get("redis_connection_string")
# Mailing config
env_resend_api_key = os.environ.get("LEARNHOUSE_RESEND_API_KEY")
env_mailgun_api_key = os.environ.get("LEARNHOUSE_MAILGUN_API_KEY")
env_mailgun_domain = os.environ.get("LEARNHOUSE_MAILGUN_DOMAIN")
env_system_email_address = os.environ.get("LEARNHOUSE_SYSTEM_EMAIL_ADDRESS")
resend_api_key = env_resend_api_key or yaml_config.get("mailing_config", {}).get(
"resend_api_key"
mailgun_api_key = env_mailgun_api_key or yaml_config.get("mailing_config", {}).get(
"mailgun_api_key"
)
mailgun_domain = env_mailgun_domain or yaml_config.get("mailing_domain", {}).get(
"mailgun_domain"
)
system_email_address = env_system_email_address or yaml_config.get(
"mailing_config", {}
@ -251,11 +256,11 @@ def get_learnhouse_config() -> LearnHouseConfig:
env_stripe_webhook_standard_secret = os.environ.get("LEARNHOUSE_STRIPE_WEBHOOK_STANDARD_SECRET")
env_stripe_webhook_connect_secret = os.environ.get("LEARNHOUSE_STRIPE_WEBHOOK_CONNECT_SECRET")
env_stripe_client_id = os.environ.get("LEARNHOUSE_STRIPE_CLIENT_ID")
stripe_secret_key = env_stripe_secret_key or yaml_config.get("payments_config", {}).get(
"stripe", {}
).get("stripe_secret_key")
stripe_publishable_key = env_stripe_publishable_key or yaml_config.get("payments_config", {}).get(
"stripe", {}
).get("stripe_publishable_key")
@ -313,7 +318,7 @@ def get_learnhouse_config() -> LearnHouseConfig:
ai_config=ai_config,
redis_config=RedisConfig(redis_connection_string=redis_connection_string),
mailing_config=MailingConfig(
resend_api_key=resend_api_key, system_email_address=system_email_address
mailgun_api_key=mailgun_api_key, mailgun_domain=mailgun_domain, system_email_address=system_email_address
),
payments_config=InternalPaymentsConfig(
stripe=InternalStripeConfig(