Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:return: an iterator over matching directives.
"""
directives = self.contents.get_type(obj.Sentence)
return [d for d in directives if len(d) > 0 and d[0] == name and (match is None or match(d))]
def parse(self, raw_list, add_spaces=False):
""" Parses lists into a ServerBlock object, and creates a
corresponding VirtualHost metadata object. """
super(ServerBlock, self).parse(raw_list, add_spaces)
self.vhost = nginx_obj.VirtualHost(
self.context.filename if self.context is not None else "",
self.addrs, self.ssl, True, self.server_names, self.dump_unspaced_list()[1],
self.get_path(), self)
self._update_vhost()
NGINX_PARSING_HOOKS = (ServerBlock, obj.Block, Include, obj.Sentence, obj.Directives)
def parse(self, raw_list, add_spaces=False):
""" Parses lists into a ServerBlock object, and creates a
corresponding VirtualHost metadata object. """
super(ServerBlock, self).parse(raw_list, add_spaces)
self.vhost = nginx_obj.VirtualHost(
self.context.filename if self.context is not None else "",
self.addrs, self.ssl, True, self.server_names, self.dump_unspaced_list()[1],
self.get_path(), self)
self._update_vhost()