one-sdk-js icon indicating copy to clipboard operation
one-sdk-js copied to clipboard

[BUG] OneSDK configuration using environmental variables do not work

Open janhalama opened this issue 2 years ago • 0 comments

OneSDK configuration using environmental variables do not work in case that options parameter of SuperfaceClient is defined.

This is relevant for environment variables that have defined default value in OneSDK package. This is list of affected env variables:

  • SUPERFACE_API_URL
  • SUPERFACE_PATH
  • SUPERFACE_METRIC_DEBOUNCE_TIME_MIN
  • SUPERFACE_METRIC_DEBOUNCE_TIME_MAX
  • SUPERFACE_DISABLE_METRIC_REPORTING
  • SUPERFACE_SANDBOX_TIMEOUT
  • SUPERFACE_CACHE_TIMEOUT

The bug is not affecting SUPERFACE_SDK_TOKEN env variable.

Expected Behavior

Configuration of OneSDK should be possible using combination of code and environment variables. Code configuration should take priority over environmental variables.

Current Behavior

At this moment once single options parameter is configured in code, environment variables can not be used for OneSDK configuration.

Possible Solution

Merge default params after merging code and env config params.

Steps to Reproduce

MRE repository: https://github.com/janhalama/one-sdk-config-bug-example

janhalama avatar Apr 20 '23 11:04 janhalama