Skip to content

✨ Allow setting client's API url via an environment variable#370

Merged
wwilsman merged 1 commit intomasterfrom
ww/client-api-env-var
Jun 17, 2021
Merged

✨ Allow setting client's API url via an environment variable#370
wwilsman merged 1 commit intomasterfrom
ww/client-api-env-var

Conversation

@wwilsman
Copy link
Copy Markdown
Contributor

What is this?

In the world of @percy/agent, setting the PERCY_API environment variable allowed you to override the URL used by client to communicate with the Percy API. That behavior was lost when moving to the new @percy/cli world, but can be useful when manually testing or interacting with a local development API.

With client's proxy agent, we indiscriminately proxy all API requests through HTTPS since our production API server is guaranteed to be HTTPS. However, with the potential to change the API URL to a locally hosted URL, it might not always be HTTPS. So we need to check the protocol of the API URL to disable the HTTPS proxy agent and allow the request util to default to the appropriate agent based on the request's protocol.

This shouldn't be used by end users, so PERCY_API felt too user friendly. I decided on PERCY_CLIENT_API_URL (to be hyper specific) but am open to changing it.

@wwilsman wwilsman added the ✨ enhancement New feature or request label Jun 17, 2021
@wwilsman wwilsman requested a review from Robdel12 June 17, 2021 16:37
Copy link
Copy Markdown
Contributor

@Robdel12 Robdel12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏁

@djones
Copy link
Copy Markdown

djones commented Jun 17, 2021

👍🏻 Thanks for putting this together @wwilsman

@wwilsman wwilsman merged commit 93f6c21 into master Jun 17, 2021
@wwilsman wwilsman deleted the ww/client-api-env-var branch June 17, 2021 17:12
samarsault pushed a commit that referenced this pull request Mar 3, 2023
Bumps @percy/sdk-utils from 1.0.0-beta.52 to 1.0.0-beta.56.

---
updated-dependencies:
- dependency-name: "@percy/sdk-utils"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants