Skip to content

Commit c26cf24

Browse files
committed
Use the main lagoon route for webhook setup
1 parent 42a25fc commit c26cf24

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

app/core/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class Settings(BaseSettings):
3333
WEBHOOK_SIG: str = os.getenv("WEBHOOK_SIG", "whsec_test_1234567890")
3434

3535
model_config = ConfigDict(env_file=".env")
36+
main_route: str = os.getenv("LAGOON_ROUTE", "http://localhost:8800")
3637

3738
def model_post_init(self, values):
3839
# Add Lagoon routes to CORS origins if available

app/services/stripe.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from fastapi import HTTPException, status
66
from sqlalchemy.orm import Session
77
from app.db.models import DBTeam, DBSystemSecret
8+
from app.core.config import settings
89

910
# Configure logger
1011
logger = logging.getLogger(__name__)
@@ -107,7 +108,7 @@ async def setup_stripe_webhook(webhook_key: str, webhook_route: str, db: Session
107108
return
108109

109110
# Get the base URL from environment
110-
base_url = os.getenv("BACKEND_URL", "http://localhost:8800")
111+
base_url = settings.main_route
111112
webhook_url = urljoin(base_url, webhook_route)
112113

113114
# List existing webhook endpoints

scripts/initialise_resources.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from sqlalchemy.orm import sessionmaker, Session
1515
from app.db.database import engine
1616
from app.db.models import Base, DBUser
17+
from app.core.config import settings
1718
from app.core.security import get_password_hash
1819
from app.services.ses import SESService
1920
from app.services.stripe import setup_stripe_webhook
@@ -114,6 +115,8 @@ def init_ses_templates():
114115

115116
def main():
116117
try:
118+
print(f"Initialising resources for environment: {os.getenv('ENV_SUFFIX', 'local')}")
119+
print(f"Main route: {settings.main_route}")
117120
db = init_database()
118121
init_webhooks(db)
119122
init_ses_templates()

0 commit comments

Comments
 (0)