diff --git a/README.md b/README.md index 51fa1b7..0da0971 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,9 @@ INVESTMENT_PAYEE_NAME="Investment" INVESTMENT_CATEGORY_GROUP_NAME="Income" # optional, name of the category for added investment tracking transactions INVESTMENT_CATEGORY_NAME="Investment" + +# optional, for logging into SimpleFIN +SIMPLEFIN_CREDENTIALS="" ``` ## Installation @@ -215,6 +218,9 @@ You can optionally change the category group used for the transactions by settin You can optionally change the category used for the transactions by setting `INVESTMENT_CATEGORY_NAME` in the `.env` file. +You can optionally store the SimpleFIN credentials generated from your setup +token by setting `SIMPLEFIN_CREDENTIALS` in the `.env` file. + To run: ```console diff --git a/track-investments.js b/track-investments.js index 74902ed..07b98fb 100644 --- a/track-investments.js +++ b/track-investments.js @@ -6,6 +6,10 @@ require("dotenv").config(); const getCredentials = async () => { + if (process.env.SIMPLEFIN_CREDENTIALS) { + return process.env.SIMPLEFIN_CREDENTIALS; + } + const token = readline.question('Enter your SimpleFIN setup token: '); const url = atob(token.trim()); @@ -19,6 +23,7 @@ const getCredentials = async () => { const data = `${username}:${pw}`; fs.writeFileSync('simplefin.credentials', data); + console.log('SimpleFIN credentials:', data); return data; };