Add configurable maximum layer size in nginx

This commit is contained in:
Joseph Schorr 2017-02-27 13:03:20 -05:00
parent 76de324ca8
commit dd35677712
3 changed files with 12 additions and 11 deletions

View file

@ -28,19 +28,17 @@ def generate_server_config(config):
"""
Generates server config from the app config
"""
if config:
tuf_server = config.get('TUF_SERVER', None)
tuf_host = config.get('TUF_HOST', None)
signing_enabled = config.get('FEATURE_SIGNING', False)
else:
tuf_server = None
tuf_host = None
signing_enabled = False
config = config or {}
tuf_server = config.get('TUF_SERVER', None)
tuf_host = config.get('TUF_HOST', None)
signing_enabled = config.get('FEATURE_SIGNING', False)
maximum_layer_size = config.get('MAXIMUM_LAYER_SIZE', '20G')
write_config('conf/nginx/server-base.conf',
tuf_server=tuf_server,
tuf_host=tuf_host,
signing_enabled=signing_enabled)
signing_enabled=signing_enabled,
maximum_layer_size=maximum_layer_size)
if __name__ == "__main__":

View file

@ -109,7 +109,7 @@ location ~ ^/v2 {
proxy_pass http://registry_app_server;
proxy_temp_path /tmp 1 2;
client_max_body_size 20G;
client_max_body_size {{ maximum_layer_size }};
}
location ~ ^/v1 {
@ -127,7 +127,7 @@ location ~ ^/v1 {
proxy_pass http://registry_app_server;
proxy_temp_path /tmp 1 2;
client_max_body_size 20G;
client_max_body_size {{ maximum_layer_size }};
}
location /v1/_ping {

View file

@ -426,3 +426,6 @@ class DefaultConfig(object):
# Server where TUF metadata can be found
TUF_SERVER = None
# Maximum size allowed for layers in the registry.
MAXIMUM_LAYER_SIZE = '20G'