Allow api key to be set from environment variable

In dockerised environments, secrets are usually set
from environment variables to allow them to be
overlayed securely in cases where configuration
is given by docker-compose.

Signed-off-by: Christopher Obbard <chris@64studio.com>
pull/17/head
Christopher Obbard 2022-01-03 16:37:51 +00:00
parent 7aa35fb65b
commit db76979dac
1 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/python3
from todoist.api import TodoistAPI
import os
import sys
import time
import requests
@ -902,7 +903,7 @@ def main():
parser = argparse.ArgumentParser(
formatter_class=make_wide(argparse.HelpFormatter, w=120, h=60))
parser.add_argument('-a', '--api_key',
help='takes your Todoist API Key.', type=str)
help='takes your Todoist API Key.', default=os.environ.get('TODOIST_API_KEY') type=str)
parser.add_argument(
'-l', '--label', help='enable next action labelling. Define which label to use.', type=str)
parser.add_argument(