Skip to content

Commit

Permalink
Use the projects url matching the current running calendar deploy stage
Browse files Browse the repository at this point in the history
  • Loading branch information
timbeccue committed Feb 16, 2023
2 parents 3604a26 + 92fc23d commit d65329d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d65329d

Please sign in to comment.