mirror of https://github.com/status-im/consul.git
Rename NewClient/NewServer
Now that duplicate constructors have been removed we can use the shorter names for the single constructor.
This commit is contained in:
parent
0420d91cdd
commit
3b82ad0955
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue