quentinsf / IMAPdedup

IMAP message de-duplicator
https://quentinsf.com/software/imapdedup
GNU General Public License v2.0
321 stars 57 forks source link

pull password from env? #34

Closed jvanasco closed 7 years ago

jvanasco commented 7 years ago

Hi. I wanted to suggest a slight change -- grabbing the password off the environment.

This avoids constantly having to type it into the commandline or writing a wrapper script...

    + import os
    ...

     if not options.password and not options.process:
    -    options.password = getpass.getpass()
    +    options.password = os.getenv('IMAPdedup_pass') or getpass.getpass()

so then you just invoke it as:

export IMAPdedup_pass=sekrit
./imapdedup.py -s foo -u bar -x "INBOX"
./imapdedup.py -s foo -u bar -x "INBOX.2"
./imapdedup.py -s foo -u bar -x "INBOX.3"

and you're not prompted for the password.

quentinsf commented 7 years ago

Thanks Jonathan - I like that - it's now in there, though I went for a more traditional all-upper-case variable name!

IMAPDEDUP_PASSWORD

Sorry I took so long to get around to it :-)