calcurse-caldav: Read password from env variable

Add the option to read the basic authentication password from the
CALCURSE_CALDAV_PASSWORD environment variable.

Signed-off-by: Randy Ramos <rramos1295@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Randy Ramos 2017-11-10 07:37:28 -05:00 committed by Lukas Fleischer
parent 5b94be2246
commit 9be2c106e6

View File

@ -508,6 +508,9 @@ authcode = args.authcode
verbose = args.verbose
debug = args.debug
# Read environment variables
password = os.getenv('CALCURSE_CALDAV_PASSWORD')
# Read configuration.
config = configparser.RawConfigParser()
if verbose:
@ -563,10 +566,8 @@ if config.has_option('Auth', 'UserName'):
else:
username = None
if config.has_option('Auth', 'Password'):
if config.has_option('Auth', 'Password') and not password:
password = config.get('Auth', 'Password')
else:
password = None
if config.has_section('CustomHeaders'):
custom_headers = dict(config.items('CustomHeaders'))