From 60b4efad67ba3b22dfaf83820c772cd7f5ff137c Mon Sep 17 00:00:00 2001 From: Kevin Guillaumond <46726602+KevinGDialpad@users.noreply.github.com> Date: Sat, 14 Mar 2020 08:57:39 -0700 Subject: [PATCH] Update config docs to match DEFAULT_CONFIG (#1803) * Set REAL_IP_HEADER's default value to "X-Real-IP" * Update config instead --- docs/sanic/config.rst | 14 ++++++++++++-- sanic/config.py | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/sanic/config.rst b/docs/sanic/config.rst index 0e34bcc7..366d22d1 100644 --- a/docs/sanic/config.rst +++ b/docs/sanic/config.rst @@ -115,15 +115,25 @@ Out of the box there are just a few predefined values which can be overwritten w +---------------------------+-------------------+-----------------------------------------------------------------------------+ | KEEP_ALIVE_TIMEOUT | 5 | How long to hold a TCP connection open (sec) | +---------------------------+-------------------+-----------------------------------------------------------------------------+ +| WEBSOCKET_MAX_SIZE | 2^20 | Maximum size for incoming messages (bytes) | ++---------------------------+-------------------+-----------------------------------------------------------------------------+ +| WEBSOCKET_MAX_QUEUE | 32 | Maximum length of the queue that holds incoming messages | ++---------------------------+-------------------+-----------------------------------------------------------------------------+ +| WEBSOCKET_READ_LIMIT | 2^16 | High-water limit of the buffer for incoming bytes | ++---------------------------+-------------------+-----------------------------------------------------------------------------+ +| WEBSOCKET_WRITE_LIMIT | 2^16 | High-water limit of the buffer for outgoing bytes | ++---------------------------+-------------------+-----------------------------------------------------------------------------+ | GRACEFUL_SHUTDOWN_TIMEOUT | 15.0 | How long to wait to force close non-idle connection (sec) | +---------------------------+-------------------+-----------------------------------------------------------------------------+ | ACCESS_LOG | True | Disable or enable access log | +---------------------------+-------------------+-----------------------------------------------------------------------------+ -| PROXIES_COUNT | -1 | The number of proxy servers in front of the app (e.g. nginx; see below) | +| FORWARDED_SECRET | None | Used to securely identify a specific proxy server (see below) | ++---------------------------+-------------------+-----------------------------------------------------------------------------+ +| PROXIES_COUNT | None | The number of proxy servers in front of the app (e.g. nginx; see below) | +---------------------------+-------------------+-----------------------------------------------------------------------------+ | FORWARDED_FOR_HEADER | "X-Forwarded-For" | The name of "X-Forwarded-For" HTTP header that contains client and proxy ip | +---------------------------+-------------------+-----------------------------------------------------------------------------+ -| REAL_IP_HEADER | "X-Real-IP" | The name of "X-Real-IP" HTTP header that contains real client ip | +| REAL_IP_HEADER | None | The name of "X-Real-IP" HTTP header that contains real client ip | +---------------------------+-------------------+-----------------------------------------------------------------------------+ The different Timeout variables: diff --git a/sanic/config.py b/sanic/config.py index 539ea45c..58de2110 100644 --- a/sanic/config.py +++ b/sanic/config.py @@ -20,7 +20,7 @@ DEFAULT_CONFIG = { "RESPONSE_TIMEOUT": 60, # 60 seconds "KEEP_ALIVE": True, "KEEP_ALIVE_TIMEOUT": 5, # 5 seconds - "WEBSOCKET_MAX_SIZE": 2 ** 20, # 1 megabytes + "WEBSOCKET_MAX_SIZE": 2 ** 20, # 1 megabyte "WEBSOCKET_MAX_QUEUE": 32, "WEBSOCKET_READ_LIMIT": 2 ** 16, "WEBSOCKET_WRITE_LIMIT": 2 ** 16,