Move autopilot setup to a separate file

This commit is contained in:
Kyle Havlovitz 2017-12-18 16:55:51 -08:00
parent 9e1ba6fb4e
commit 044c38aa7b
No known key found for this signature in database
GPG Key ID: 8A5E6B173056AD6C
2 changed files with 10 additions and 3 deletions

View File

@ -294,9 +294,8 @@ func NewServerLogger(config *Config, logger *log.Logger, tokens *token.Store) (*
shutdownCh: shutdownCh, shutdownCh: shutdownCh,
} }
// Set up autopilot // Run divergent OSS/Enterprise setup
apDelegate := &AutopilotDelegate{s} s.startServerEnterprise(config)
s.autopilot = autopilot.NewAutopilot(logger, apDelegate, config.AutopilotInterval, config.ServerHealthInterval)
// Initialize the stats fetcher that autopilot will use. // Initialize the stats fetcher that autopilot will use.
s.statsFetcher = NewStatsFetcher(logger, s.connPool, s.config.Datacenter) s.statsFetcher = NewStatsFetcher(logger, s.connPool, s.config.Datacenter)

View File

@ -1,5 +1,7 @@
package consul package consul
import "github.com/hashicorp/consul/agent/consul/autopilot"
func init() { func init() {
registerEndpoint(func(s *Server) interface{} { return &ACL{s} }) registerEndpoint(func(s *Server) interface{} { return &ACL{s} })
registerEndpoint(func(s *Server) interface{} { return &Catalog{s} }) registerEndpoint(func(s *Server) interface{} { return &Catalog{s} })
@ -13,3 +15,9 @@ func init() {
registerEndpoint(func(s *Server) interface{} { return &Status{s} }) registerEndpoint(func(s *Server) interface{} { return &Status{s} })
registerEndpoint(func(s *Server) interface{} { return &Txn{s} }) registerEndpoint(func(s *Server) interface{} { return &Txn{s} })
} }
func (s *Server) startServerEnterprise(config *Config) {
// Set up autopilot
apDelegate := &AutopilotDelegate{s}
s.autopilot = autopilot.NewAutopilot(s.logger, apDelegate, config.AutopilotInterval, config.ServerHealthInterval)
}