17344: Remove client code setting X-External-Client header.
[arvados.git] / tools / keep-rsync / keep-rsync.go
index b1513a02a7e30f3211b39bbf0a4335c8dd9cf8d9..7e519f775ba9bb4d500e578c891a55d50f1fae34 100644 (file)
@@ -1,3 +1,7 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
 package main
 
 import (
 package main
 
 import (
@@ -13,10 +17,13 @@ import (
        "strings"
        "time"
 
        "strings"
        "time"
 
-       "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
-       "git.curoverse.com/arvados.git/sdk/go/keepclient"
+       "git.arvados.org/arvados.git/lib/cmd"
+       "git.arvados.org/arvados.git/sdk/go/arvadosclient"
+       "git.arvados.org/arvados.git/sdk/go/keepclient"
 )
 
 )
 
+var version = "dev"
+
 func main() {
        err := doMain()
        if err != nil {
 func main() {
        err := doMain()
        if err != nil {
@@ -65,8 +72,17 @@ func doMain() error {
                0,
                "Lifetime of blob permission signatures on source keepservers. If not provided, this will be retrieved from the API server's discovery document.")
 
                0,
                "Lifetime of blob permission signatures on source keepservers. If not provided, this will be retrieved from the API server's discovery document.")
 
-       // Parse args; omit the first arg which is the command name
-       flags.Parse(os.Args[1:])
+       getVersion := flags.Bool(
+               "version",
+               false,
+               "Print version information and exit.")
+
+       if ok, code := cmd.ParseFlags(flags, os.Args[0], os.Args[1:], "", os.Stderr); !ok {
+               os.Exit(code)
+       } else if *getVersion {
+               fmt.Printf("%s %s\n", os.Args[0], version)
+               os.Exit(0)
+       }
 
        srcConfig, srcBlobSigningKey, err := loadConfig(*srcConfigFile)
        if err != nil {
 
        srcConfig, srcBlobSigningKey, err := loadConfig(*srcConfigFile)
        if err != nil {
@@ -102,7 +118,6 @@ type apiConfig struct {
        APIToken        string
        APIHost         string
        APIHostInsecure bool
        APIToken        string
        APIHost         string
        APIHostInsecure bool
-       ExternalClient  bool
 }
 
 // Load src and dst config from given files
 }
 
 // Load src and dst config from given files
@@ -148,8 +163,6 @@ func readConfigFromFile(filename string) (config apiConfig, blobSigningKey strin
                        config.APIHost = value
                case "ARVADOS_API_HOST_INSECURE":
                        config.APIHostInsecure = arvadosclient.StringBool(value)
                        config.APIHost = value
                case "ARVADOS_API_HOST_INSECURE":
                        config.APIHostInsecure = arvadosclient.StringBool(value)
-               case "ARVADOS_EXTERNAL_CLIENT":
-                       config.ExternalClient = arvadosclient.StringBool(value)
                case "ARVADOS_BLOB_SIGNING_KEY":
                        blobSigningKey = value
                }
                case "ARVADOS_BLOB_SIGNING_KEY":
                        blobSigningKey = value
                }
@@ -165,7 +178,6 @@ func setupKeepClient(config apiConfig, keepServicesJSON string, isDst bool, repl
                ApiInsecure: config.APIHostInsecure,
                Client: &http.Client{Transport: &http.Transport{
                        TLSClientConfig: &tls.Config{InsecureSkipVerify: config.APIHostInsecure}}},
                ApiInsecure: config.APIHostInsecure,
                Client: &http.Client{Transport: &http.Transport{
                        TLSClientConfig: &tls.Config{InsecureSkipVerify: config.APIHostInsecure}}},
-               External: config.ExternalClient,
        }
 
        // If keepServicesJSON is provided, use it instead of service discovery
        }
 
        // If keepServicesJSON is provided, use it instead of service discovery