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)
| 45 | // - host:port |
| 46 | // - https?://host[:port][/path] |
| 47 | func newClient(server string, opts ...client.ClientOption) *client.Client { |
| 48 | if server == "" { |
| 49 | return client.NewOrFail(opts...) |
| 50 | } |
| 51 | cl := client.NewOrFail(append(opts[:len(opts):cap(opts)], client.OptionServer(server))...) |
| 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 | } |
no test coverage detected