Allow setting request timeout in syncthingctl
This commit is contained in:
parent
690804be5c
commit
7d6c7de834
|
@ -226,6 +226,11 @@ int Application::loadConfig()
|
|||
return res;
|
||||
}
|
||||
|
||||
// read request timeout
|
||||
if (const int res = assignIntegerFromArg(m_args.requestTimeout, m_settings.requestTimeout)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
// disable polling for information which is not used by any CLI operation so far
|
||||
m_settings.trafficPollInterval = 0;
|
||||
m_settings.devStatsPollInterval = 0;
|
||||
|
|
|
@ -38,6 +38,7 @@ Args::Args()
|
|||
, url("url", 'u', "specifies the Syncthing URL, default is http://localhost:8080", { "URL" })
|
||||
, credentials("credentials", 'c', "specifies user name and password", { "user name", "password" })
|
||||
, certificate("cert", '\0', "specifies the certificate used by the Syncthing instance", { "path" })
|
||||
, requestTimeout("request-timeout", '\0', "specifies the transfer timeout for network requests in milliseconds", { "timeout" })
|
||||
{
|
||||
dir.setConstraints(0, Argument::varValueCount);
|
||||
dir.setValueCompletionBehavior(
|
||||
|
@ -74,7 +75,7 @@ Args::Args()
|
|||
credentials.setExample(PROJECT_NAME " status --dir dir1 --credentials name supersecret");
|
||||
|
||||
parser.setMainArguments({ &status, &log, &stop, &restart, &rescan, &rescanAll, &pause, &resume, &waitForIdle, &pwd, &cat, &edit, &configFile,
|
||||
&apiKey, &url, &credentials, &certificate, &parser.noColorArg(), &parser.helpArg() });
|
||||
&apiKey, &url, &credentials, &certificate, &requestTimeout, &parser.noColorArg(), &parser.helpArg() });
|
||||
|
||||
// allow setting default values via environment
|
||||
configFile.setEnvironmentVariable("SYNCTHING_CTL_CONFIG_FILE");
|
||||
|
|
|
@ -16,7 +16,7 @@ struct Args {
|
|||
ConfigValueArgument stats, dir, dev, allDirs, allDevs;
|
||||
ConfigValueArgument atLeast, timeout;
|
||||
ConfigValueArgument editor;
|
||||
ConfigValueArgument configFile, apiKey, url, credentials, certificate;
|
||||
ConfigValueArgument configFile, apiKey, url, credentials, certificate, requestTimeout;
|
||||
};
|
||||
|
||||
} // namespace Cli
|
||||
|
|
Loading…
Reference in New Issue