mirror of
https://github.com/docker/docs.git
synced 2026-04-01 16:58:54 +07:00
pull out the log.Fatal from pkg/store to the discovery level
Signed-off-by: Alexandre Beslic <abronan@docker.com>
This commit is contained in:
@@ -56,7 +56,10 @@ func InitializeConsul(endpoints []string, options *Config) (Store, error) {
|
||||
s.setTimeout(options.ConnectionTimeout)
|
||||
}
|
||||
if options.EphemeralTTL != 0 {
|
||||
s.setEphemeralTTL(options.EphemeralTTL)
|
||||
err := s.setEphemeralTTL(options.EphemeralTTL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,11 +88,12 @@ func (s *Consul) setTimeout(time time.Duration) {
|
||||
}
|
||||
|
||||
// SetEphemeralTTL sets the ttl for ephemeral nodes
|
||||
func (s *Consul) setEphemeralTTL(ttl time.Duration) {
|
||||
func (s *Consul) setEphemeralTTL(ttl time.Duration) error {
|
||||
if ttl < MinimumTimeToLive {
|
||||
log.Fatal("Consul does not allow a ttl < 10s, please specify a ttl >= 10s")
|
||||
return ErrInvalidTTL
|
||||
}
|
||||
s.ephemeralTTL = ttl
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateEphemeralSession creates the a global session
|
||||
|
||||
@@ -23,6 +23,8 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrInvalidTTL is a specific error to consul
|
||||
ErrInvalidTTL = errors.New("Invalid TTL, please change the value to the miminum allowed ttl for the chosen store")
|
||||
// ErrNotSupported is exported
|
||||
ErrNotSupported = errors.New("Backend storage not supported yet, please choose another one")
|
||||
// ErrNotImplemented is exported
|
||||
|
||||
Reference in New Issue
Block a user