mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-21 16:49:10 +01:00
moved tunnel config file inialization to ClientContext
This commit is contained in:
parent
2b4c3b8d1f
commit
6eec353c2b
2 changed files with 12 additions and 13 deletions
|
@ -252,14 +252,17 @@ namespace client
|
||||||
void ClientContext::ReadTunnels ()
|
void ClientContext::ReadTunnels ()
|
||||||
{
|
{
|
||||||
boost::property_tree::ptree pt;
|
boost::property_tree::ptree pt;
|
||||||
std::string pathTunConf;
|
std::string tunConf; i2p::config::GetOption("tunconf", tunConf);
|
||||||
i2p::config::GetOption("tunconf", pathTunConf);
|
if (tunConf == "")
|
||||||
if (pathTunConf == "")
|
tunConf = i2p::fs::DataDirPath ("tunnels.cfg");
|
||||||
return;
|
LogPrint(eLogDebug, "FS: tunnels config file: ", tunConf);
|
||||||
try {
|
try
|
||||||
boost::property_tree::read_ini (pathTunConf, pt);
|
{
|
||||||
} catch (std::exception& ex) {
|
boost::property_tree::read_ini (tunConf, pt);
|
||||||
LogPrint (eLogWarning, "Clients: Can't read ", pathTunConf, ": ", ex.what ());
|
}
|
||||||
|
catch (std::exception& ex)
|
||||||
|
{
|
||||||
|
LogPrint (eLogWarning, "Clients: Can't read ", tunConf, ": ", ex.what ());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,7 +350,7 @@ namespace client
|
||||||
numServerTunnels++;
|
numServerTunnels++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LogPrint (eLogWarning, "Clients: Unknown section type=", type, " of ", name, " in ", pathTunConf);
|
LogPrint (eLogWarning, "Clients: Unknown section type=", type, " of ", name, " in ", tunConf);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (std::exception& ex)
|
catch (std::exception& ex)
|
||||||
|
|
|
@ -64,7 +64,6 @@ namespace i2p
|
||||||
i2p::config::ParseCmdline(argc, argv);
|
i2p::config::ParseCmdline(argc, argv);
|
||||||
|
|
||||||
std::string config; i2p::config::GetOption("conf", config);
|
std::string config; i2p::config::GetOption("conf", config);
|
||||||
std::string tunconf; i2p::config::GetOption("tunconf", tunconf);
|
|
||||||
std::string datadir; i2p::config::GetOption("datadir", datadir);
|
std::string datadir; i2p::config::GetOption("datadir", datadir);
|
||||||
i2p::fs::DetectDataDir(datadir, IsService());
|
i2p::fs::DetectDataDir(datadir, IsService());
|
||||||
i2p::fs::Init();
|
i2p::fs::Init();
|
||||||
|
@ -76,8 +75,6 @@ namespace i2p
|
||||||
// use i2p.cong only if exists
|
// use i2p.cong only if exists
|
||||||
if (!i2p::fs::Exists (config)) config = ""; /* reset */
|
if (!i2p::fs::Exists (config)) config = ""; /* reset */
|
||||||
}
|
}
|
||||||
if (tunconf == "")
|
|
||||||
tunconf = i2p::fs::DataDirPath("tunnels.cfg");
|
|
||||||
|
|
||||||
i2p::config::ParseConfig(config);
|
i2p::config::ParseConfig(config);
|
||||||
i2p::config::Finalize();
|
i2p::config::Finalize();
|
||||||
|
@ -91,7 +88,6 @@ namespace i2p
|
||||||
|
|
||||||
LogPrint(eLogInfo, "i2pd v", VERSION, " starting");
|
LogPrint(eLogInfo, "i2pd v", VERSION, " starting");
|
||||||
LogPrint(eLogDebug, "FS: main config file: ", config);
|
LogPrint(eLogDebug, "FS: main config file: ", config);
|
||||||
LogPrint(eLogDebug, "FS: tunnels config: ", tunconf);
|
|
||||||
LogPrint(eLogDebug, "FS: data directory: ", datadir);
|
LogPrint(eLogDebug, "FS: data directory: ", datadir);
|
||||||
|
|
||||||
uint16_t port; i2p::config::GetOption("port", port);
|
uint16_t port; i2p::config::GetOption("port", port);
|
||||||
|
|
Loading…
Add table
Reference in a new issue