hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

refactor(cypress): read creds from env instead of hardcoding the path

Open pixincreate opened this issue 1 year ago • 0 comments

Type of Change

  • [ ] Bugfix
  • [ ] New feature
  • [ ] Enhancement
  • [x] Refactoring
  • [ ] Dependency updates
  • [ ] Documentation
  • [x] CI/CD

Description

  • Beginning of Cypress refactor
  • Removed the hardcoded ConnectorAuthDetails for reading it through env
  • Code formatting
  • Remove duplicated logger code for calling it through a function
  • Documentation update is done at #4380

Usage

export DEBUG=cypress:cli
export CYPRESS_CONNECTOR="connector_name"
export CYPRESS_BASEURL="http://127.0.0.1:8080"
export CYPRESS_ADMINAPIKEY='some_api_key'

# Introduced change
export CYPRESS_CONNECTOR_AUTH_FILE_PATH='path/to/creds.json'

npm run cypress

Additional Changes

  • [ ] This PR modifies the API contract
  • [ ] This PR modifies the database schema
  • [ ] This PR modifies application configuration/environment variables

Motivation and Context

There has been many occurrences where developers accidentally exposed the path to creds.json from their PC (although it is not too much of a security risk, it still poses a significant risk on surface level). To avoid that from happening again in future, this measure has been taken.

How did you test it?

Followed the Usage section mentioned above and ran the tests, they ran fine without any issues:

image

Checklist

  • [ ] I formatted the code cargo +nightly fmt --all
  • [ ] I addressed lints thrown by cargo clippy
  • [x] I reviewed the submitted code
  • [ ] I added unit tests for my changes where possible
  • [ ] I added a CHANGELOG entry if applicable

pixincreate avatar Apr 22 '24 18:04 pixincreate