superfaceai / one-sdk-js

1️⃣ One Node.js SDK for all the APIs you want to integrate with
https://superface.ai
MIT License
46 stars 3 forks source link

[BUG] OneSDK configuration using environmental variables do not work #343

Open janhalama opened 1 year ago

janhalama commented 1 year ago

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:

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