Skip to content

Commit

Permalink
fix: move settings initialization outside inner function in gitlab_we…
Browse files Browse the repository at this point in the history
…bhook
  • Loading branch information
mrT23 committed Oct 7, 2024
1 parent ada0a3d commit cd158f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pr_agent/servers/gitlab_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def should_process_pr_logic(data) -> bool:
async def gitlab_webhook(background_tasks: BackgroundTasks, request: Request):
start_time = datetime.now()
request_json = await request.json()
context["settings"] = copy.deepcopy(global_settings)

async def inner(data: dict):
log_context = {"server_type": "gitlab_app"}
Expand All @@ -154,7 +155,6 @@ async def inner(data: dict):
secret_dict = json.loads(secret)
gitlab_token = secret_dict["gitlab_token"]
log_context["token_id"] = secret_dict.get("token_name", secret_dict.get("id", "unknown"))
context["settings"] = copy.deepcopy(global_settings)
context["settings"].gitlab.personal_access_token = gitlab_token
except Exception as e:
get_logger().error(f"Failed to validate secret {request_token}: {e}")
Expand Down

0 comments on commit cd158f2

Please sign in to comment.