mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-26 10:55:24 +02:00
Merge 7be9b09ee0
into 6db7c5733d
This commit is contained in:
commit
c6d110e682
5 changed files with 17 additions and 9 deletions
|
@ -7,7 +7,7 @@
|
||||||
## by removing the "#" symbol.
|
## by removing the "#" symbol.
|
||||||
|
|
||||||
## Tunnels config file
|
## Tunnels config file
|
||||||
## Default: ~/.i2pd/tunnels.conf or /var/lib/i2pd/tunnels.conf
|
## Default: ~/.config/i2pd/tunnels.conf or /var/lib/i2pd/tunnels.conf
|
||||||
# tunconf = /var/lib/i2pd/tunnels.conf
|
# tunconf = /var/lib/i2pd/tunnels.conf
|
||||||
|
|
||||||
## Where to write pidfile (don't write by default)
|
## Where to write pidfile (don't write by default)
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
# loglevel = info
|
# loglevel = info
|
||||||
|
|
||||||
## Path to storage of i2pd data (RI, keys, peer profiles, ...)
|
## Path to storage of i2pd data (RI, keys, peer profiles, ...)
|
||||||
## Default: ~/.i2pd or /var/lib/i2pd
|
## Default: ~/.config/i2pd or /var/lib/i2pd
|
||||||
# datadir = /var/lib/i2pd
|
# datadir = /var/lib/i2pd
|
||||||
|
|
||||||
## Daemon mode. Router will go to background after start
|
## Daemon mode. Router will go to background after start
|
||||||
|
|
6
debian/i2pd.1
vendored
6
debian/i2pd.1
vendored
|
@ -22,13 +22,13 @@ Any of the configuration options below can be used in the \fBDAEMON_ARGS\fR vari
|
||||||
Show available options.
|
Show available options.
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-conf=\fR
|
\fB\-\-conf=\fR
|
||||||
Config file (default: \fI~/.i2pd/i2pd.conf\fR or \fI/var/lib/i2pd/i2pd.conf\fR)
|
Config file (default: \fI~/.config/i2pd/i2pd.conf\fR or \fI/var/lib/i2pd/i2pd.conf\fR)
|
||||||
.BR
|
.BR
|
||||||
This parameter will be silently ignored if the specified config file does not exist.
|
This parameter will be silently ignored if the specified config file does not exist.
|
||||||
Options specified on the command line take precedence over those in the config file.
|
Options specified on the command line take precedence over those in the config file.
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-tunconf=\fR
|
\fB\-\-tunconf=\fR
|
||||||
Tunnels config file (default: \fI~/.i2pd/tunnels.conf\fR or \fI/var/lib/i2pd/tunnels.conf\fR)
|
Tunnels config file (default: \fI~/.config/i2pd/tunnels.conf\fR or \fI/var/lib/i2pd/tunnels.conf\fR)
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-pidfile=\fR
|
\fB\-\-pidfile=\fR
|
||||||
Where to write pidfile (don\'t write by default)
|
Where to write pidfile (don\'t write by default)
|
||||||
|
@ -87,7 +87,7 @@ i2pd configuration files (when running as a system service)
|
||||||
i2pd profile directory (when running as a system service, see \fB\-\-service\fR above)
|
i2pd profile directory (when running as a system service, see \fB\-\-service\fR above)
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
$HOME/.i2pd/
|
$HOME/.config/i2pd/
|
||||||
.RS 4
|
.RS 4
|
||||||
i2pd profile directory (when running as a normal user)
|
i2pd profile directory (when running as a normal user)
|
||||||
.RE
|
.RE
|
||||||
|
|
|
@ -32,8 +32,8 @@ namespace config {
|
||||||
options_description general("General options");
|
options_description general("General options");
|
||||||
general.add_options()
|
general.add_options()
|
||||||
("help", "Show this message")
|
("help", "Show this message")
|
||||||
("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 ~/.config/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 ~/.config/i2pd/tunnels.conf or /var/lib/i2pd/tunnels.conf)")
|
||||||
("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)")
|
||||||
|
|
|
@ -81,6 +81,14 @@ namespace fs {
|
||||||
dataDir = "/var/lib/" + appName;
|
dataDir = "/var/lib/" + appName;
|
||||||
} else if (home != NULL && strlen(home) > 0) {
|
} else if (home != NULL && strlen(home) > 0) {
|
||||||
dataDir = std::string(home) + "/." + appName;
|
dataDir = std::string(home) + "/." + appName;
|
||||||
|
if (!boost::filesystem::exists(dataDir)) { // backward compatibility
|
||||||
|
char *config_home = getenv("XDG_CONFIG_HOME");
|
||||||
|
if (config_home != NULL && strlen(config_home) > 0) {
|
||||||
|
dataDir = std::string(config_home) + "/" + appName;
|
||||||
|
} else {
|
||||||
|
dataDir = std::string(home) + "/.config/" + appName;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dataDir = "/tmp/" + appName;
|
dataDir = "/tmp/" + appName;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +98,7 @@ namespace fs {
|
||||||
|
|
||||||
bool Init() {
|
bool Init() {
|
||||||
if (!boost::filesystem::exists(dataDir))
|
if (!boost::filesystem::exists(dataDir))
|
||||||
boost::filesystem::create_directory(dataDir);
|
boost::filesystem::create_directories(dataDir);
|
||||||
std::string destinations = DataDirPath("destinations");
|
std::string destinations = DataDirPath("destinations");
|
||||||
if (!boost::filesystem::exists(destinations))
|
if (!boost::filesystem::exists(destinations))
|
||||||
boost::filesystem::create_directory(destinations);
|
boost::filesystem::create_directory(destinations);
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace fs {
|
||||||
* Windows < Vista: C:\Documents and Settings\Username\Application Data\i2pd\
|
* Windows < Vista: C:\Documents and Settings\Username\Application Data\i2pd\
|
||||||
* Windows >= Vista: C:\Users\Username\AppData\Roaming\i2pd\
|
* Windows >= Vista: C:\Users\Username\AppData\Roaming\i2pd\
|
||||||
* Mac: /Library/Application Support/i2pd/ or ~/Library/Application Support/i2pd/
|
* Mac: /Library/Application Support/i2pd/ or ~/Library/Application Support/i2pd/
|
||||||
* Unix: /var/lib/i2pd/ (system=1) >> ~/.i2pd/ or /tmp/i2pd/
|
* Unix: /var/lib/i2pd/ (system=1) >> ~/.config/i2pd/ or /tmp/i2pd/
|
||||||
*/
|
*/
|
||||||
void DetectDataDir(const std::string & cmdline_datadir, bool isService = false);
|
void DetectDataDir(const std::string & cmdline_datadir, bool isService = false);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue