def load_routes(self):
        """ load route from configuration file """
        fname = os.path.join(self.get_spooldir(), 'routes')
        if not os.path.exists(fname):
            return

        # do we need to relad routes ?
        mtime = os.stat(fname).st_mtime
        if self.rmtime == mtime:
            return
        self.rmtime = mtime
        
        # build rules
        with open(fname, 'r') as f:
            routes_conf = json.load(f)
            for name, conf in routes_conf.items():
                host = conf.get('host', '(.*)')
                routes = conf.get('routes', {})
                self.hosts.append((re.compile(host), name))
                _routes = []
                for (route, route_conf) in routes.items():
                    if 'remote' in route_conf:
                        
                        # build base_uri
                        is_ssl = 'ssl' in route_conf
                        remote = parse_address(route_conf.get('remote'), 80)
                        host = get_host(remote, is_ssl=is_ssl)
                       
                        route_conf.update(dict(
                            host = host,
                            base_uri =  base_uri(host, is_ssl=is_ssl),
                            remote = remote,
                            listen = self.address,
                            listen_ssl = self.is_listen_ssl()))

                        if ROUTE_RE.match(route):
                            spec = re.compile(route)
                        else:
                            spec = re.compile("%s(.*)" % route)
                        _routes.append((route, spec, route_conf))
                
                _routes.sort()
                _routes.reverse()
                self.routes[name] = _routes
            self.hosts.sort()
            self.hosts.reverse()
dataset/ETHPy150Open benoitc/hroute/hroute/config.py/RouteConfig.load_routes/original