mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
Create config.DefaultConsulConfig()
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/nomad/nomad"
|
||||
cconfig "github.com/hashicorp/nomad/nomad/structs/config"
|
||||
)
|
||||
|
||||
var nextPort uint32 = 17000
|
||||
@@ -43,7 +42,7 @@ func makeAgent(t testing.TB, cb func(*Config)) (string, *Agent) {
|
||||
Serf: getPort(),
|
||||
}
|
||||
conf.NodeName = fmt.Sprintf("Node %d", conf.Ports.RPC)
|
||||
conf.Consul = &cconfig.ConsulConfig{}
|
||||
conf.Consul = &config.DefaultConsulConfig()
|
||||
|
||||
// Tighten the Serf timing
|
||||
config.SerfConfig.MemberlistConfig.SuspicionMult = 2
|
||||
|
||||
@@ -61,7 +61,7 @@ func (c *Command) readConfig() *Config {
|
||||
// Make a new, empty config.
|
||||
cmdConfig := &Config{
|
||||
Atlas: &AtlasConfig{},
|
||||
Consul: &config.ConsulConfig{},
|
||||
Consul: config.DefaultConsulConfig(),
|
||||
Client: &ClientConfig{},
|
||||
Ports: &Ports{},
|
||||
Server: &ServerConfig{},
|
||||
|
||||
@@ -377,14 +377,7 @@ func DefaultConfig() *Config {
|
||||
Addresses: &Addresses{},
|
||||
AdvertiseAddrs: &AdvertiseAddrs{},
|
||||
Atlas: &AtlasConfig{},
|
||||
Consul: &config.ConsulConfig{
|
||||
ServerServiceName: "nomad",
|
||||
ClientServiceName: "nomad-client",
|
||||
AutoAdvertise: true,
|
||||
ServerAutoJoin: true,
|
||||
ClientAutoJoin: true,
|
||||
Timeout: 5 * time.Second,
|
||||
},
|
||||
Consul: config.DefaultConsulConfig(),
|
||||
Client: &ClientConfig{
|
||||
Enabled: false,
|
||||
NetworkSpeed: 100,
|
||||
|
||||
@@ -557,7 +557,7 @@ func parseConsulConfig(result **config.ConsulConfig, list *ast.ObjectList) error
|
||||
return fmt.Errorf("only one 'consul' block allowed")
|
||||
}
|
||||
|
||||
// Get our consul object
|
||||
// Get our Consul object
|
||||
listVal := list.Items[0].Val
|
||||
|
||||
// Check for invalid keys
|
||||
@@ -587,7 +587,7 @@ func parseConsulConfig(result **config.ConsulConfig, list *ast.ObjectList) error
|
||||
return err
|
||||
}
|
||||
|
||||
var consulConfig config.ConsulConfig
|
||||
consulConfig := config.DefaultConsulConfig()
|
||||
dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
||||
DecodeHook: mapstructure.StringToTimeDurationHookFunc(),
|
||||
WeaklyTypedInput: true,
|
||||
@@ -600,7 +600,7 @@ func parseConsulConfig(result **config.ConsulConfig, list *ast.ObjectList) error
|
||||
return err
|
||||
}
|
||||
|
||||
*result = &consulConfig
|
||||
*result = consulConfig
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ import (
|
||||
"github.com/hashicorp/consul/lib"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
|
||||
cconfig "github.com/hashicorp/nomad/client/config"
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
"github.com/hashicorp/nomad/nomad/structs/config"
|
||||
"github.com/hashicorp/nomad/nomad/types"
|
||||
@@ -160,7 +159,7 @@ func NewSyncer(consulConfig *config.ConsulConfig, shutdownCh chan struct{}, logg
|
||||
|
||||
// If a nil consulConfig was provided, fall back to the default config
|
||||
if consulConfig == nil {
|
||||
consulConfig = cconfig.DefaultConfig().ConsulConfig
|
||||
consulConfig = config.DefaultConsulConfig()
|
||||
}
|
||||
|
||||
if consulConfig.Addr != "" {
|
||||
|
||||
@@ -46,7 +46,7 @@ func TestConsulServiceRegisterServices(t *testing.T) {
|
||||
t.Skip()
|
||||
|
||||
shutdownCh := make(chan struct{})
|
||||
cs, err := NewSyncer(&config.ConsulConfig{}, shutdownCh, logger)
|
||||
cs, err := NewSyncer(&config.DefaultConsulConfig(), shutdownCh, logger)
|
||||
if err != nil {
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
@@ -82,7 +82,7 @@ func TestConsulServiceUpdateService(t *testing.T) {
|
||||
t.Skip()
|
||||
|
||||
shutdownCh := make(chan struct{})
|
||||
cs, err := NewSyncer(&config.ConsulConfig{}, shutdownCh, logger)
|
||||
cs, err := NewSyncer(&config.DefaultConsulConfig(), shutdownCh, logger)
|
||||
if err != nil {
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user