From 560e74886773281b0a0e6da8202d374eb441f498 Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Sat, 2 Nov 2024 12:24:25 +0300 Subject: [PATCH] [~] Refactor --- d1/nginx_config.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/d1/nginx_config.py b/d1/nginx_config.py index 2449e26..c7939db 100644 --- a/d1/nginx_config.py +++ b/d1/nginx_config.py @@ -43,9 +43,23 @@ def forward( else: server_name = 'default_server' - if not server_name in sections: + if ( + not server_name in sections + ): sections[server_name] = [] + if 'client_max_body_size' in entry: + client_max_body_size = entry['client_max_body_size'] + else: + client_max_body_size = '50M' + + assert isinstance(client_max_body_size, str) + + sections[server_name].append( + r''' + client_max_body_size %s; + ''' % client_max_body_size + ) location_get = lambda location_body, location_path2, prefix=None,: ( r''' @@ -138,7 +152,7 @@ server { server_name {server_name}; listen 80 {default_server}; - client_max_body_size 50M; + #client_max_body_size 50M; {sections_config} }