mirror of https://github.com/status-im/consul.git
Move autopilot initializing to oss file
This commit is contained in:
parent
039e7f1880
commit
77dc52f430
|
@ -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} })
|
||||
|
@ -14,10 +12,4 @@ func init() {
|
|||
registerEndpoint(func(s *Server) interface{} { return &Session{s} })
|
||||
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