mirror of
https://github.com/kopia/kopia.git
synced 2026-01-22 05:18:06 -05:00
Support for remote content repository where all contents and manifests are fetched over HTTP(S) instead of locally manipulating blob storage * server: implement content and manifest access APIs * apiclient: moved Kopia API client to separate package * content: exposed content.ValidatePrefix() * manifest: added JSON serialization attributes to EntryMetadata * repo: changed repo.Open() to return Repository instead of *DirectRepository * repo: added apiServerRepository * cli: added 'kopia repository connect server' This sets up repository connection via the API server instead of directly-manipulated storage. * server: add support for specifying a list of usernames/password via --htpasswd-file * tests: added API server repository E2E test * server: only return manifests (policies and snapshots) belonging to authenticated user
26 lines
783 B
Go
26 lines
783 B
Go
package cli
|
|
|
|
import (
|
|
"github.com/pkg/errors"
|
|
|
|
"github.com/kopia/kopia/internal/apiclient"
|
|
)
|
|
|
|
var (
|
|
serverAddress = serverCommands.Flag("address", "Server address").Default("http://127.0.0.1:51515").String()
|
|
serverUsername = serverCommands.Flag("server-username", "HTTP server username (basic auth)").Envar("KOPIA_SERVER_USERNAME").Default("kopia").String()
|
|
serverPassword = serverCommands.Flag("server-password", "HTTP server password (basic auth)").Envar("KOPIA_SERVER_PASSWORD").String()
|
|
)
|
|
|
|
func serverAPIClientOptions() (apiclient.Options, error) {
|
|
if *serverAddress == "" {
|
|
return apiclient.Options{}, errors.Errorf("missing server address")
|
|
}
|
|
|
|
return apiclient.Options{
|
|
BaseURL: *serverAddress,
|
|
Username: *serverUsername,
|
|
Password: *serverPassword,
|
|
}, nil
|
|
}
|