diff --git a/swh/deposit/settings/production.py b/swh/deposit/settings/production.py index 81e6b7055b3d541acc18471e8d649a233a50dffa..61b5ee6065b9f082f95076b136cb1f35a54c1387 100644 --- a/swh/deposit/settings/production.py +++ b/swh/deposit/settings/production.py @@ -123,15 +123,27 @@ if cfg_azure: f"Production: invalid configuration; missing {key} config entry." ) + # Default options + options = dict( + azure_container=cfg_azure["container_name"], + connection_string=cfg_azure["connection_string"], + ) + + # Which may be enhanced with some extra options, lookup "object_parameters" in + # https://django-storages.readthedocs.io/en/latest/backends/azure.html + object_parameters = {} + for optional_config_key in ["content_type", "content_disposition"]: + if optional_config_key in cfg_azure: + object_parameters[optional_config_key] = cfg_azure[optional_config_key] + + options.update(dict(object_parameters=object_parameters)) + STORAGES = { "staticfiles": { "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage" }, "default": { "BACKEND": "storages.backends.azure_storage.AzureStorage", - "OPTIONS": { - "azure_container": cfg_azure["container_name"], - "connection_string": cfg_azure["connection_string"], - }, + "OPTIONS": options, }, }