From 9be2c106e62fd4825181454576727591fa2d2b04 Mon Sep 17 00:00:00 2001 From: Randy Ramos Date: Fri, 10 Nov 2017 07:37:28 -0500 Subject: 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 Signed-off-by: Lukas Fleischer --- contrib/caldav/calcurse-caldav.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/caldav/calcurse-caldav.py b/contrib/caldav/calcurse-caldav.py index 7519af3..4d5e471 100755 --- a/contrib/caldav/calcurse-caldav.py +++ b/contrib/caldav/calcurse-caldav.py @@ -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')) -- cgit v1.2.3-70-g09d2