MCPcopy
hub / github.com/perkeep/perkeep / newClient

Function newClient

cmd/pk-devimport/devimport.go:47–56  ·  view source on GitHub ↗

newClient returns a Perkeep client for the server. The server may be: - blank, to use the default in the config file - an alias, to use that named alias in the config file - host:port - https?://host[:port][/path]

(server string, opts ...client.ClientOption)

Source from the content-addressed store, hash-verified

45// - host:port
46// - https?://host[:port][/path]
47func newClient(server string, opts ...client.ClientOption) *client.Client {
48 if server == "" {
49 return client.NewOrFail(opts...)
50 }
51 cl := client.NewOrFail(append([]client.ClientOption{client.OptionServer(server)}, opts...)...)
52 if err := cl.SetupAuth(); err != nil {
53 log.Fatalf("Could not setup auth for connecting to %v: %v", server, err)
54 }
55 return cl
56}
57
58var (
59 flagServer = flag.String("server", "", "Server to search. "+serverFlagHelp)

Callers 1

newImporterHostFunction · 0.70

Calls 4

NewOrFailFunction · 0.92
OptionServerFunction · 0.92
SetupAuthMethod · 0.80
FatalfMethod · 0.65

Tested by

no test coverage detected