Move autopilot initializing to oss file
This commit is contained in:
parent
044c38aa7b
commit
dfc165a47b
|
@ -0,0 +1,9 @@
|
|||
// +build !ent
|
||||
package consul
|
||||
|
||||
import "github.com/hashicorp/consul/agent/consul/autopilot"
|
||||
|
||||
func (s *Server) initAutopilot(config *Config) {
|
||||
apDelegate := &AutopilotDelegate{s}
|
||||
s.autopilot = autopilot.NewAutopilot(s.logger, apDelegate, config.AutopilotInterval, config.ServerHealthInterval)
|
||||
}
|
|
@ -294,9 +294,6 @@ func NewServerLogger(config *Config, logger *log.Logger, tokens *token.Store) (*
|
|||
shutdownCh: shutdownCh,
|
||||
}
|
||||
|
||||
// Run divergent OSS/Enterprise setup
|
||||
s.startServerEnterprise(config)
|
||||
|
||||
// Initialize the stats fetcher that autopilot will use.
|
||||
s.statsFetcher = NewStatsFetcher(logger, s.connPool, s.config.Datacenter)
|
||||
|
||||
|
@ -418,6 +415,9 @@ func NewServerLogger(config *Config, logger *log.Logger, tokens *token.Store) (*
|
|||
// Start the metrics handlers.
|
||||
go s.sessionStats()
|
||||
|
||||
// Initialize Autopilot
|
||||
s.initAutopilot(config)
|
||||
|
||||
// Start the server health checking.
|
||||
go s.autopilot.ServerHealthLoop(s.shutdownCh)
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package consul
|
||||
|
||||
import "github.com/hashicorp/consul/agent/consul/autopilot"
|
||||
|
||||
func init() {
|
||||
registerEndpoint(func(s *Server) interface{} { return &ACL{s} })
|
||||
registerEndpoint(func(s *Server) interface{} { return &Catalog{s} })
|
||||
|
@ -15,9 +13,3 @@ func init() {
|
|||
registerEndpoint(func(s *Server) interface{} { return &Status{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)
|
||||
}
|
Loading…
Reference in New Issue