-// keep-rsync source and destination clients
-var (
- arvSrc arvadosclient.ArvadosClient
- arvDst arvadosclient.ArvadosClient
- kcSrc *keepclient.KeepClient
- kcDst *keepclient.KeepClient
-)
-
-// Initializes keep-rsync using the config provided
-func initializeKeepRsync() (err error) {
- // arvSrc from srcConfig
- arvSrc, err = arvadosclient.New(srcConfig)
- if err != nil {
- return
- }
-
- // arvDst from dstConfig
- arvDst, err = arvadosclient.New(dstConfig)
- if err != nil {
- return
- }
-
- // Get default replications value from destination, if it is not already provided
- if replications == 0 {
- value, err := arvDst.Discovery("defaultCollectionReplication")
- if err == nil {
- replications = int(value.(float64))
- } else {
- replications = 2
- }
+// setup keepclient using the config provided
+func setupKeepClient(config apiConfig, keepServicesJSON string, isDst bool, replications int, srcBlobSignatureTTL time.Duration) (kc *keepclient.KeepClient, blobSignatureTTL time.Duration, err error) {
+ arv := arvadosclient.ArvadosClient{
+ ApiToken: config.APIToken,
+ ApiServer: config.APIHost,
+ ApiInsecure: config.APIHostInsecure,
+ Client: &http.Client{Transport: &http.Transport{
+ TLSClientConfig: &tls.Config{InsecureSkipVerify: config.APIHostInsecure}}},
+ External: config.ExternalClient,