From 92fc23d95d0cdc8d2afbe267a0c6bd64f20b6cdc Mon Sep 17 00:00:00 2001 From: Tim Beccue Date: Thu, 16 Feb 2023 16:04:22 -0500 Subject: [PATCH] Use projects url matching the active calendar deploy stage --- handler.py | 9 ++++++++- serverless.yml | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/handler.py b/handler.py index 31901bd..8a70d70 100644 --- a/handler.py +++ b/handler.py @@ -108,7 +108,14 @@ def getProject(project_name, created_at): Requested project details JSON, if response code 200. """ - url = f"https://projects.photonranch.org/{str(os.getenv(STAGE))}/get-project" + # Use the same projects deployment as the one running the calendar. + # E.g. The dev calendar backend will call the dev projects backend + stage = os.getenv('STAGE') + # The production projects url replaces 'prod' with 'projects' in the url + if stage == 'prod': + stage = 'projects' + + url = f"https://projects.photonranch.org/{stage}/get-project" body = json.dumps({ "project_name": project_name, "created_at": created_at, diff --git a/serverless.yml b/serverless.yml index 6bfe661..cc2b80e 100644 --- a/serverless.yml +++ b/serverless.yml @@ -52,7 +52,7 @@ provider: DYNAMODB_CALENDAR: ${self:custom.calendarTableName} AUTH0_CLIENT_ID: ${file(./secrets.json):AUTH0_CLIENT_ID} AUTH0_CLIENT_PUBLIC_KEY: ${file(./public_key)} - STAGE: ${self:custom.stage.${self:provider.stage}} + STAGE: ${self:provider.stage} iam: role: statements: