Merge pull request #24 from hashicorp/sethvargo/vault_url_parse
Use a pointer config instead
This commit is contained in:
commit
67752bdfcb
|
@ -10,7 +10,7 @@ import (
|
|||
// testHTTPServer creates a test HTTP server that handles requests until
|
||||
// the listener returned is closed.
|
||||
func testHTTPServer(
|
||||
t *testing.T, handler http.Handler) (Config, net.Listener) {
|
||||
t *testing.T, handler http.Handler) (*Config, net.Listener) {
|
||||
ln, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
|
|
|
@ -33,8 +33,8 @@ type Config struct {
|
|||
|
||||
// DefaultConfig returns a default configuration for the client. It is
|
||||
// safe to modify the return value of this function.
|
||||
func DefaultConfig() Config {
|
||||
config := Config{
|
||||
func DefaultConfig() *Config {
|
||||
config := &Config{
|
||||
Address: "https://127.0.0.1:8200",
|
||||
HttpClient: &http.Client{},
|
||||
}
|
||||
|
@ -46,11 +46,11 @@ func DefaultConfig() Config {
|
|||
// NewClient.
|
||||
type Client struct {
|
||||
addr *url.URL
|
||||
config Config
|
||||
config *Config
|
||||
}
|
||||
|
||||
// NewClient returns a new client for the given configuration.
|
||||
func NewClient(c Config) (*Client, error) {
|
||||
func NewClient(c *Config) (*Client, error) {
|
||||
u, err := url.Parse(c.Address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue