Browse Source

add certsdir option (#1642)

Signed-off-by: R4SAS <r4sas@i2pmail.org>
pull/1677/head
R4SAS 3 years ago
parent
commit
5bfab0a796
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2
  1. 4
      contrib/i2pd.conf
  2. 1
      libi2pd/Config.cpp
  3. 9
      libi2pd/Family.cpp
  4. 9
      libi2pd/Reseed.cpp

4
contrib/i2pd.conf

@ -15,6 +15,10 @@
## Default: ~/.i2pd/tunnels.d or /var/lib/i2pd/tunnels.d ## Default: ~/.i2pd/tunnels.d or /var/lib/i2pd/tunnels.d
# tunnelsdir = /var/lib/i2pd/tunnels.d # tunnelsdir = /var/lib/i2pd/tunnels.d
## Path to certificates used for verifying .su3, families
## Default: ~/.i2pd/certificates or /var/lib/i2pd/certificates
# certsdir = /var/lib/i2pd/certificates
## Where to write pidfile (default: i2pd.pid, not used in Windows) ## Where to write pidfile (default: i2pd.pid, not used in Windows)
# pidfile = /run/i2pd.pid # pidfile = /run/i2pd.pid

1
libi2pd/Config.cpp

@ -37,6 +37,7 @@ namespace config {
("conf", value<std::string>()->default_value(""), "Path to main i2pd config file (default: try ~/.i2pd/i2pd.conf or /var/lib/i2pd/i2pd.conf)") ("conf", value<std::string>()->default_value(""), "Path to main i2pd config file (default: try ~/.i2pd/i2pd.conf or /var/lib/i2pd/i2pd.conf)")
("tunconf", value<std::string>()->default_value(""), "Path to config with tunnels list and options (default: try ~/.i2pd/tunnels.conf or /var/lib/i2pd/tunnels.conf)") ("tunconf", value<std::string>()->default_value(""), "Path to config with tunnels list and options (default: try ~/.i2pd/tunnels.conf or /var/lib/i2pd/tunnels.conf)")
("tunnelsdir", value<std::string>()->default_value(""), "Path to extra tunnels' configs folder (default: ~/.i2pd/tunnels.d or /var/lib/i2pd/tunnels.d") ("tunnelsdir", value<std::string>()->default_value(""), "Path to extra tunnels' configs folder (default: ~/.i2pd/tunnels.d or /var/lib/i2pd/tunnels.d")
("certsdir", value<std::string>()->default_value(""), "Path to certificates used for verifying .su3, families (default: ~/.i2pd/certificates or /var/lib/i2pd/certificates")
("pidfile", value<std::string>()->default_value(""), "Path to pidfile (default: ~/i2pd/i2pd.pid or /var/lib/i2pd/i2pd.pid)") ("pidfile", value<std::string>()->default_value(""), "Path to pidfile (default: ~/i2pd/i2pd.pid or /var/lib/i2pd/i2pd.pid)")
("log", value<std::string>()->default_value(""), "Logs destination: stdout, file, syslog (stdout if not set)") ("log", value<std::string>()->default_value(""), "Logs destination: stdout, file, syslog (stdout if not set)")
("logfile", value<std::string>()->default_value(""), "Path to logfile (stdout if not set, autodetect if daemon)") ("logfile", value<std::string>()->default_value(""), "Path to logfile (stdout if not set, autodetect if daemon)")

9
libi2pd/Family.cpp

@ -98,7 +98,14 @@ namespace data
void Families::LoadCertificates () void Families::LoadCertificates ()
{ {
std::string certDir = i2p::fs::DataDirPath("certificates", "family"); std::string certDir;
std::string certsdir; i2p::config::GetOption("certsdir", certsdir);
if (!i2p::config::IsDefault("certsdir"))
certDir = certsdir + i2p::fs::dirSep + "family";
if (certDir.empty() || !i2p::fs::Exists(certDir))
std::string certDir = i2p::fs::DataDirPath("certificates", "family");
std::vector<std::string> files; std::vector<std::string> files;
int numCertificates = 0; int numCertificates = 0;

9
libi2pd/Reseed.cpp

@ -497,7 +497,14 @@ namespace data
void Reseeder::LoadCertificates () void Reseeder::LoadCertificates ()
{ {
std::string certDir = i2p::fs::DataDirPath("certificates", "reseed"); std::string certDir;
std::string certsdir; i2p::config::GetOption("certsdir", certsdir);
if (!i2p::config::IsDefault("certsdir"))
certDir = certsdir + i2p::fs::dirSep + "reseed";
if (certDir.empty() || !i2p::fs::Exists(certDir))
std::string certDir = i2p::fs::DataDirPath("certificates", "reseed");
std::vector<std::string> files; std::vector<std::string> files;
int numCertificates = 0; int numCertificates = 0;

Loading…
Cancel
Save