bitpay / node-bitpay-client

A Node.js module and command line client for interacting with BitPay's Cryptographically Secure API
102 stars 95 forks source link

Handle missing config file #80

Open tomzaoral opened 8 years ago

tomzaoral commented 8 years ago

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.

kleetus commented 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.

ecejas commented 5 years ago

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".

ecejas commented 5 years ago

Better yet would be to load the config file only if exists. Fail if there is not config file and not override given.