Utilities¶
Convienence utilities for building nginx configs
-
nginx.config.helpers.
dumps
(config_list)[source]¶ Dumps a string representation of a config. Accepts a list of config objects.
Parameters: config_list (list) – A list of config objects from this module Return type: str
-
nginx.config.helpers.
duplicate_options
(key, values)[source]¶ There are many cases when building configs that you may have duplicate keys
This function will produce an EmptyBlock object with duplicate keys but unique values
Example:
from nginx.config.helpers import duplicate_options from nginx.config.api import Location loc = Location( '/', duplicate_options('uwsgi_cache_valid', (['404', '5s'], ['200', '60s'])), )
Which would produce:
location / { uwsgi_cache_valid 200 60s; uwsgi_cache_valid 404 5s; }