def test_property_get(self): inip = IniParser("configExample.ini") self.assertEqual(inip.get("PORT", "DHT"), '4424') self.assertEqual(inip.get("HOSTNAME", "DHT"), "127.0.0.1")
def test_property_get(self): inip = IniParser("configExample.ini") self.assertEqual(inip.get("PORT", "DHT"), "4424") self.assertEqual(inip.get("HOSTNAME", "DHT"), "127.0.0.1")
# Try to load config.ini from parameters configname = None for key, val in opts: if key == "-c" : configname = val logfile = None hostkey = None nodeIdentifier = None ipaddress = "localhost" apiport = None bootip = bootport = None kx_port = 0 if configname: projectIni = IniParser(configname) ipaddress = projectIni.get("HOSTNAME", "DHT") port = int(projectIni.get("PORT", "")) apiport = int(projectIni.get("PORT", "DHT")) bootip = projectIni.get("OVERLAY_HOSTNAME", "DHT") bootport = projectIni.get("PORT", "BOOTSTRAP") hostkey = projectIni.get("HOSTKEY", "") kx_port = int(projectIni.get("PORT", "KX")) logfile = projectIni.get("LOG") if logfile: logging.basicConfig(filename=logfile, format='[%(levelname)s:%(funcName)s] %(message)s', level=logging.INFO) else:
# Try to load config.ini from parameters configname = None for key, val in opts: if key == "-c": configname = val logfile = None hostkey = None nodeIdentifier = None ipaddress = "localhost" apiport = None bootip = bootport = None kx_port = 0 if configname: projectIni = IniParser(configname) ipaddress = projectIni.get("HOSTNAME", "DHT") port = int(projectIni.get("PORT", "")) apiport = int(projectIni.get("PORT", "DHT")) bootip = projectIni.get("OVERLAY_HOSTNAME", "DHT") bootport = projectIni.get("PORT", "BOOTSTRAP") hostkey = projectIni.get("HOSTKEY", "") kx_port = int(projectIni.get("PORT", "KX")) logfile = projectIni.get("LOG") if logfile: logging.basicConfig(filename=logfile, format='[%(levelname)s:%(funcName)s] %(message)s',