Skip to content

Commit

Permalink
fix: misc fixes for backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
rohan-chaturvedi committed Dec 3, 2024
1 parent a4b86c3 commit 7ec5bef
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion backend/api/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ def perform_vercel_sync(environment_sync):
secrets,
environment_sync.authentication.id,
vercel_project["id"],
vercel_team["id"],
vercel_team["id"] if vercel_team is not None else None,
vercel_environment,
vercel_secret_type,
)
Expand Down
12 changes: 9 additions & 3 deletions backend/api/utils/syncing/vercel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ def list_vercel_projects(credential_id):

def get_existing_env_vars(token, project_id, team_id=None):
"""Retrieve all environment variables for a specific Vercel project."""
url = f"{VERCEL_API_BASE_URL}/v9/projects/{project_id}/env?teamId={team_id}"
url = f"{VERCEL_API_BASE_URL}/v9/projects/{project_id}/env"
if team_id is not None:
url += f"?teamId={team_id}"
response = requests.get(url, headers=get_vercel_headers(token))

if response.status_code != 200:
Expand All @@ -127,7 +129,9 @@ def get_existing_env_vars(token, project_id, team_id=None):

def delete_env_var(token, project_id, team_id, env_var_id):
"""Delete a Vercel environment variable using its ID."""
url = f"{VERCEL_API_BASE_URL}/v9/projects/{project_id}/env/{env_var_id}?teamId={team_id}"
url = f"{VERCEL_API_BASE_URL}/v9/projects/{project_id}/env/{env_var_id}"
if team_id is not None:
url += f"?teamId={team_id}"
response = requests.delete(url, headers=get_vercel_headers(token))

if response.status_code != 200:
Expand Down Expand Up @@ -199,7 +203,9 @@ def sync_vercel_secrets(

# Bulk create environment variables
if payload:
url = f"{VERCEL_API_BASE_URL}/v10/projects/{project_id}/env?upsert=true&teamId={team_id}"
url = f"{VERCEL_API_BASE_URL}/v10/projects/{project_id}/env?upsert=true"
if team_id is not None:
url += f"&teamId={team_id}"
response = requests.post(
url, headers=get_vercel_headers(token), json=payload
)
Expand Down
5 changes: 0 additions & 5 deletions backend/backend/graphene/mutations/syncing.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ class RailwayResourceInput(graphene.InputObjectType):
name = graphene.String(required=True)


class VercelResourceInput(graphene.InputObjectType):
id = graphene.ID(required=True)
name = graphene.String(required=True)


class InitEnvSync(graphene.Mutation):
class Arguments:
app_id = graphene.ID()
Expand Down

0 comments on commit 7ec5bef

Please sign in to comment.