How to use the certbot-nginx.certbot_nginx.nginx_parser_obj.ServerBlock function in certbot-nginx

To help you get started, we’ve selected a few certbot-nginx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github certbot / certbot / certbot-nginx / certbot_nginx / nginx_parser_obj.py View on Github external
: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)
github certbot / certbot / certbot-nginx / certbot_nginx / nginx_parser_obj.py View on Github external
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()