vtainio / Nordea-to-YNAB

Import transactions from Nordea to YNAB
MIT License
7 stars 1 forks source link

Store YNAB_USERNAME and YNAB_PASSWORD in .env #2

Closed KPLauritzen closed 7 years ago

KPLauritzen commented 7 years ago

By using https://github.com/theskumar/python-dotenv, you can avoid have YNAB_PASSWORD stored in your .bashrc or something similar.

Add a file: .env with the contents

YNAB_USERNAME=batman
YNAB_PASSWORD=notmypassword

and load that with the dotenv library.

See KPLauritzen/Nordea-to-YNAB@6cf782dc1b0d0cee2d234b36791be0deb64cd1de

chadrien commented 7 years ago

@KPLauritzen but then, wouldn't an .env file actually be .bashrc or something similar 😛 ?

While I agree that it's a nice tool to avoid polluting your "global" env with project related stuff, it's actually technically the same as having it in your .bashrc :)

KPLauritzen commented 7 years ago

@chadrien I guess it is somewhat the same :) It is your password in plaintext on a file on your computer. It is easier to manage access to a project specific .env file. chmod 600 .env, and you should be good to go.

Maybe it is a solution to a non-existent problem, but exactly this thing of not "polluting your global env" seems good practice. At least for my case, sometimes working on a multi-user system, it is nice to be able to say "have a look at my bashrc" without worrying about a password leaking.

vtainio commented 7 years ago

@KPLauritzen Thanks for the suggestion!

I've been using an .env file and autoenv myself but I totally forgot that python has this module.

Even though I agree that it's technically the same as having it in your .bashrc, it's nice to add specific instructions for potential users, and having a local .env file is IMO really good for that.

Do you @KPLauritzen want to open a pull request directly out of your changes? I can write the documentation if you don't feel like it :)