allow SimpleFIN credentials via ENV

This commit is contained in:
Robert Dyer
2024-08-11 20:53:54 -05:00
parent 78b61ec76e
commit 7fe986c429
2 changed files with 11 additions and 0 deletions
+6
View File
@@ -44,6 +44,9 @@ INVESTMENT_PAYEE_NAME="Investment"
INVESTMENT_CATEGORY_GROUP_NAME="Income" INVESTMENT_CATEGORY_GROUP_NAME="Income"
# optional, name of the category for added investment tracking transactions # optional, name of the category for added investment tracking transactions
INVESTMENT_CATEGORY_NAME="Investment" INVESTMENT_CATEGORY_NAME="Investment"
# optional, for logging into SimpleFIN
SIMPLEFIN_CREDENTIALS="<credentials - not the setup token!>"
``` ```
## Installation ## 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 You can optionally change the category used for the transactions by setting
`INVESTMENT_CATEGORY_NAME` in the `.env` file. `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: To run:
```console ```console
+5
View File
@@ -6,6 +6,10 @@ require("dotenv").config();
const getCredentials = async () => { const getCredentials = async () => {
if (process.env.SIMPLEFIN_CREDENTIALS) {
return process.env.SIMPLEFIN_CREDENTIALS;
}
const token = readline.question('Enter your SimpleFIN setup token: '); const token = readline.question('Enter your SimpleFIN setup token: ');
const url = atob(token.trim()); const url = atob(token.trim());
@@ -19,6 +23,7 @@ const getCredentials = async () => {
const data = `${username}:${pw}`; const data = `${username}:${pw}`;
fs.writeFileSync('simplefin.credentials', data); fs.writeFileSync('simplefin.credentials', data);
console.log('SimpleFIN credentials:', data);
return data; return data;
}; };