From f10c749b7ccecee316a8fab8e6e6181b86f9508d Mon Sep 17 00:00:00 2001 From: zhangliyong Date: Fri, 12 Sep 2014 10:30:37 +0700 Subject: [PATCH] Use click's evvar to retrieve SENTRY_DSN environment value --- rq/cli/cli.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rq/cli/cli.py b/rq/cli/cli.py index faf0686..4abe8a3 100755 --- a/rq/cli/cli.py +++ b/rq/cli/cli.py @@ -134,7 +134,7 @@ def info(ctx, url, path, interval, raw, only_queues, only_workers, by_queue, que @click.option('--worker-ttl', type=int, help='Default worker timeout to be used') @click.option('--verbose', '-v', is_flag=True, help='Show more output') @click.option('--quiet', '-q', is_flag=True, help='Show less output') -@click.option('--sentry-dsn', help='Report exceptions to this Sentry DSN') +@click.option('--sentry-dsn', envvar='SENTRY_DSN', help='Report exceptions to this Sentry DSN') @click.option('--pid', help='Write the process ID number to a file at the specified path') @click.argument('queues', nargs=-1) def worker(url, config, burst, name, worker_class, job_class, queue_class, path, results_ttl, @@ -154,8 +154,7 @@ def worker(url, config, burst, name, worker_class, job_class, queue_class, path, queues = settings.get('QUEUES', ['default']) if sentry_dsn is None: - sentry_dsn = settings.get('SENTRY_DSN', - os.environ.get('SENTRY_DSN', None)) + sentry_dsn = settings.get('SENTRY_DSN') if pid: with open(os.path.expanduser(pid), "w") as fp: