mirror of
https://github.com/kopia/kopia.git
synced 2026-05-11 16:25:13 -04:00
This was caused by the client using key derivation algorithm from a config file (which did not have it when it was generated using old version of Kopia). Fixes #4254
38 lines
1.2 KiB
Go
38 lines
1.2 KiB
Go
package repo
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
// APIServerInfo is remote repository configuration stored in local configuration.
|
|
//
|
|
// NOTE: this structure is persistent on disk may be read/written using
|
|
// different versions of Kopia, so it must be backwards-compatible.
|
|
//
|
|
// Apply appropriate defaults when reading.
|
|
type APIServerInfo struct {
|
|
BaseURL string `json:"url"`
|
|
TrustedServerCertificateFingerprint string `json:"serverCertFingerprint"`
|
|
LocalCacheKeyDerivationAlgorithm string `json:"localCacheKeyDerivationAlgorithm,omitempty"`
|
|
}
|
|
|
|
// ConnectAPIServer sets up repository connection to a particular API server.
|
|
func ConnectAPIServer(ctx context.Context, configFile string, si *APIServerInfo, password string, opt *ConnectOptions) error {
|
|
lc := LocalConfig{
|
|
APIServer: si,
|
|
ClientOptions: opt.ClientOptions.ApplyDefaults(ctx, "API Server: "+si.BaseURL),
|
|
}
|
|
|
|
if err := setupCachingOptionsWithDefaults(ctx, configFile, &lc, &opt.CachingOptions, []byte(si.BaseURL)); err != nil {
|
|
return errors.Wrap(err, "unable to set up caching")
|
|
}
|
|
|
|
if err := lc.writeToFile(configFile); err != nil {
|
|
return errors.Wrap(err, "unable to write config file")
|
|
}
|
|
|
|
return verifyConnect(ctx, configFile, password)
|
|
}
|