Open tomzaoral opened 8 years ago
I am generally ok with this solution except that the non-existence of a config.json will lead to the assumption that the user wants to use https://test.bitpay.com:443 as the defaultConf object. This may not be the case and the user may not realize what host is being used. This could lead to bad things happening depending on the use case. Maybe a better solution is to read the config from a static json file that is included with the npm module -or- from an AWS file -or- a response from an api request. But, you do bring up a good point and the solution seems simple enough under a narrow band of circumstances, but I think we need explicit input on what the defaultConf object is under all circumstances.
Can someone merge this? In the age of serverless computing and the cloud seems counterintuitive to force the existence of a config file on the local "server".
Better yet would be to load the config file only if exists. Fail if there is not config file and not override given.
Use default values from test config and prevent error if you don't have access rights to HOME dir (e.g. Heroku) and therefore config file was not properly created during installation of bitpay-rest library.