diff --git a/agent/agent.go b/agent/agent.go index 021b20292c..74440efd6e 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -695,13 +695,13 @@ func (a *Agent) Start(ctx context.Context) error { // Setup either the client or the server. if c.ServerMode { - server, err := consul.NewServerWithOptions(consulCfg, options...) + server, err := consul.NewServer(consulCfg, options...) if err != nil { return fmt.Errorf("Failed to start Consul server: %v", err) } a.delegate = server } else { - client, err := consul.NewClientWithOptions(consulCfg, options...) + client, err := consul.NewClient(consulCfg, options...) if err != nil { return fmt.Errorf("Failed to start Consul client: %v", err) } diff --git a/agent/consul/client.go b/agent/consul/client.go index 8b415f5500..8d3786a421 100644 --- a/agent/consul/client.go +++ b/agent/consul/client.go @@ -88,7 +88,8 @@ type Client struct { tlsConfigurator *tlsutil.Configurator } -func NewClientWithOptions(config *Config, options ...ConsulOption) (*Client, error) { +// NewClient creates and returns a Client +func NewClient(config *Config, options ...ConsulOption) (*Client, error) { flat := flattenConsulOptions(options) tlsConfigurator := flat.tlsConfigurator diff --git a/agent/consul/leader_test.go b/agent/consul/leader_test.go index 9c632a5eab..ed34091197 100644 --- a/agent/consul/leader_test.go +++ b/agent/consul/leader_test.go @@ -1306,7 +1306,7 @@ func TestLeader_ConfigEntryBootstrap_Fail(t *testing.T) { }) tlsConf, err := tlsutil.NewConfigurator(config.ToTLSUtilConfig(), logger) require.NoError(t, err) - srv, err := NewServerWithOptions(config, + srv, err := NewServer(config, WithLogger(logger), WithTokenStore(new(token.Store)), WithTLSConfigurator(tlsConf)) diff --git a/agent/consul/server.go b/agent/consul/server.go index f878cf7692..5ba45d71ce 100644 --- a/agent/consul/server.go +++ b/agent/consul/server.go @@ -313,9 +313,9 @@ type Server struct { EnterpriseServer } -// NewServerWithOptions is used to construct a new Consul server from the configuration -// and extra options, potentially returning an error -func NewServerWithOptions(config *Config, options ...ConsulOption) (*Server, error) { +// NewServer is used to construct a new Consul server from the configuration +// and extra options, potentially returning an error. +func NewServer(config *Config, options ...ConsulOption) (*Server, error) { flat := flattenConsulOptions(options) logger := flat.logger