Skip to content

Commit

Permalink
Simplify conditionals in gunicorn_conf.py
Browse files Browse the repository at this point in the history
- Use `or` instead of `object if object else`
- Use the default behavior of `os.getenv()`: falls back to `None`
  • Loading branch information
br3ndonland committed Oct 31, 2020
1 parent 1c45f19 commit 4914a4b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions inboard/gunicorn_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ def calculate_workers(


# Gunicorn setup
max_workers_str = os.getenv("MAX_WORKERS", None)
web_concurrency_str = os.getenv("WEB_CONCURRENCY", None)
max_workers_str = os.getenv("MAX_WORKERS")
web_concurrency_str = os.getenv("WEB_CONCURRENCY")
workers_per_core_str = os.getenv("WORKERS_PER_CORE", "1")
workers = calculate_workers(max_workers_str, web_concurrency_str, workers_per_core_str)
worker_tmp_dir = "/dev/shm"
host = os.getenv("HOST", "0.0.0.0")
port = os.getenv("PORT", "80")
bind_env = os.getenv("BIND", None)
use_bind = bind_env if bind_env else f"{host}:{port}"
bind_env = os.getenv("BIND")
use_bind = bind_env or f"{host}:{port}"
use_loglevel = os.getenv("LOG_LEVEL", "info")
accesslog_var = os.getenv("ACCESS_LOG", "-")
use_accesslog = accesslog_var or None
Expand Down

0 comments on commit 4914a4b

Please sign in to comment.