kevinschaich / mintable

πŸƒ Automate your personal finances – for free, with no ads, and no data collection.
https://kevinschaich.io/mintable/
MIT License
1.53k stars 203 forks source link

Sanitize whitespace from config objects. #43

Closed blimmer closed 4 years ago

blimmer commented 4 years ago

This commit adds logic to recursively sanitize the configuration object before it's written out to disk. It trims leading and trailing whitespace from string values in arrays or objects.

Fixes #42

kevinschaich commented 4 years ago

Edit looks good to me @blimmer – however we seem to have broken the Travis job (not sure why the exit code is 0 but it didn't finish successfully):

https://travis-ci.com/kevinschaich/mintable/jobs/281691792

blimmer commented 4 years ago

Hey @kevinschaich it looks like that problem is because the PR's building off of my fork and doesn't have your mintable.config.json checked into the Travis secrets. I get the same problem when I try to run the master branch locally:

 ~/code/mintable-fork ξ‚° ξ‚  master ξ‚° yarn mintable
yarn run v1.21.1
$ node ./src/scripts/mintable.js

Using config /Users/blimmer/code/mintable-test/mintable.config.json.
Note: The messages displayed below are automated and may contain duplicates.

  βœ” Fetching current config
  βœ” Fetching current config
  βœ” Fetching current config
  βœ” Writing config
  βœ” Writing config
  βœ” Writing default config
  βœ” Fetching current config
(node:38497) UnhandledPromiseRejectionWarning: Error: Missing Plaid "client_id"
    at new Client (/Users/blimmer/code/mintable-test/node_modules/plaid/lib/PlaidClient.js:13:11)
    at Object.<anonymous> (/Users/blimmer/code/mintable-test/src/lib/plaid.js:19:22)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at /Users/blimmer/code/mintable-test/src/scripts/mintable.js:88:28
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
(node:38497) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:38497) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
✨  Done in 0.39s.

I opened https://github.com/kevinschaich/mintable/pull/51 to make it actually fail the build. However, I'm not sure what the ideal fix would be for builds on forks.

kevinschaich commented 4 years ago

Hey @blimmer thanks for that subsequent PR – I’ve also added you as a collaborator so please feel free to make your branches here rather than on a fork to avoid the Travis issue!

Will try to think of a workaround for that in the coming weeks. I might be able to just create a public β€œtemplate” account for Mintable on each of the services so my API keys are not out in the open.