Example #1
0
def parse_peer_default_config(peer_id,
                              peer_program_path,
                              logger=None,
                              apply_globals=False):
    # print "Trying to find default config for {0}, path: {1}".format(
    #                                            peer_id, peer_program_path)
    peer_parser = peer_config_parser.parser("ini")
    peer_cfg = peer_config.PeerConfig(peer_id)
    conf_path = default_config_path(peer_program_path)
    if apply_globals:
        for param, value in CONFIG_DEFAULTS.iteritems():
            peer_cfg.add_local_param(param, value)
    if conf_path:

        with codecs.open(conf_path, "r", "utf8") as f:
            if logger:
                logger.info("parsing default config "
                            "for peer %s, %s ", peer_id, conf_path)
            peer_parser.parse(f, peer_cfg)

    return peer_cfg, peer_parser
Example #2
0
 def setup(self):
     self.pc = peer_config.PeerConfig()
Example #3
0
 def setup(self):
     self.pr = peer_config_parser.PeerConfigParserJSON()
     self.conf = peer_config.PeerConfig()