mirror of https://github.com/restic/restic.git
env: add $RESTIC_CUSTOM_USER_AGENT to read custom user agent
This commit is contained in:
parent
7d54e2bdff
commit
edd3b41014
|
@ -133,7 +133,7 @@ func init() {
|
|||
f.IntVar(&globalOptions.Limits.DownloadKb, "limit-download", 0, "limits downloads to a maximum `rate` in KiB/s. (default: unlimited)")
|
||||
f.UintVar(&globalOptions.PackSize, "pack-size", 0, "set target pack `size` in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)")
|
||||
f.StringSliceVarP(&globalOptions.Options, "option", "o", []string{}, "set extended option (`key=value`, can be specified multiple times)")
|
||||
f.StringVar(&globalOptions.CustomUserAgent, "custom-user-agent", "", "set a custom user agent for outgoing http requests (default: 'Go-http-client/2.0')")
|
||||
f.StringVar(&globalOptions.CustomUserAgent, "custom-user-agent", "", "set a custom user agent for outgoing http requests (default: $RESTIC_CUSTOM_USER_AGENT)")
|
||||
// Use our "generate" command instead of the cobra provided "completion" command
|
||||
cmdRoot.CompletionOptions.DisableDefaultCmd = true
|
||||
|
||||
|
@ -154,6 +154,10 @@ func init() {
|
|||
// parse target pack size from env, on error the default value will be used
|
||||
targetPackSize, _ := strconv.ParseUint(os.Getenv("RESTIC_PACK_SIZE"), 10, 32)
|
||||
globalOptions.PackSize = uint(targetPackSize)
|
||||
|
||||
if os.Getenv("RESTIC_CUSTOM_USER_AGENT") == "" {
|
||||
globalOptions.CustomUserAgent = os.Getenv("RESTIC_CUSTOM_USER_AGENT")
|
||||
}
|
||||
}
|
||||
|
||||
func stdinIsTerminal() bool {
|
||||
|
|
|
@ -51,7 +51,7 @@ Usage help is available:
|
|||
--cache-dir directory set the cache directory. (default: use system default cache directory)
|
||||
--cleanup-cache auto remove old cache directories
|
||||
--compression mode compression mode (only available for repository format version 2), one of (auto|off|max) (default: $RESTIC_COMPRESSION) (default auto)
|
||||
--custom-user-agent value set a custom user agent for outgoing http requests (default: 'Go-http-client/2.0')
|
||||
--custom-user-agent value set a custom user agent for outgoing http requests (default: $RESTIC_CUSTOM_USER_AGENT)
|
||||
-h, --help help for restic
|
||||
--insecure-tls skip TLS certificate verification when connecting to the repository (insecure)
|
||||
--json set output mode to JSON for commands that support it
|
||||
|
|
Loading…
Reference in New Issue