Skip to content

Return direct connection details

Jan Provaznik requested to merge jp-poc-endpoints into master

What does this MR do and why?

Adds an API endpoint which can be used by FE to get all necessary info about direct connection details (url, token) which it should use for sending code completions requests.

Related to #452044 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Feature.enable(:code_suggestions_direct_completions)
  2. Test that the expected response is returned:
curl --header "PRIVATE-TOKEN: $TOKEN" --request POST http://192.168.1.8:3000/api/v4/code_suggestions/direct_access|jq .

should return a response similar to:

{
      "base_url": "http://0.0.0.0:5052",
      "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI3YWFmYzA0Zi04MDMyLTQ1NDctYWRiZC0xNDkxMDg0NzUyMTkiLCJhdWQiOiJnaXRsYWItYWktZ2F0ZXdheSIsInN1YiI6IjI5MmMzYzdjLWM1ZDUtNDhlYy1iNGJmLWYwMGI3MjRjZTU2MCIsImlzcyI6Imh0dHA6Ly8xOTIuMTY4LjEuODozMDAwIiwiaWF0IjoxNzEzMjY0NTY2LCJuYmYiOjE3MTMyNjQ1NjEsImV4cCI6MTcxMzI2ODE2NiwiZ2l0bGFiX3JlYWxtIjoic2FhcyIsInNjb3BlcyI6WyJjb2RlX3N1Z2dlc3Rpb25zIl19.G7tacEBx9gigUjpkgLkas_yGveioc7TgBrH6d2lTcF4VR61GxRJ6zCgMEz-ZRbKaRWV7yMKlXdVO_TGd_MYpnB9Bs331N-LUpXcgdj5KaWE8f5PhVLnISRcgF8GnlMzovVGJyrhBSmsNBbO8c-7Rgw6onjEW-8zQTswbQrDENneIZMoEoCdaIFQLtkvRaxbcokXvkD8RHgKYEMwp1Hkzca9qeJB83i2SIeJ08PhToh1o13KsDIaHUDTOnGPCu3d-DzZSM5KTbM_yHW8rpTXqvPhvxqhckPEayTgPGVd6jqp96zWqrzZKtMQr_4sTuLx2bijADxK_ltY_tvnv73NEXg",
      "expires_at": 1713343569,
      "headers": {
        "X-Gitlab-Instance-Id": "292c3c7c-c5d5-48ec-b4bf-f00b724ce560",
        "X-Gitlab-Realm": "saas",
        "X-Gitlab-Global-User-Id": "Df0Jhs9xlbetQR8YoZCKDZJflhxO0ZBI8uoRzmpnd1w=",
        "X-Gitlab-Host-Name": "192.168.1.8"
      }
}
Edited by Jan Provaznik

Merge request reports

Loading