Class: PgFailover::Config

Inherits:
Struct
  • Object
show all
Defined in:
lib/pg_failover/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled

Returns:

  • (Object)

    the current value of enabled



6
7
8
# File 'lib/pg_failover/config.rb', line 6

def enabled
  @enabled
end

#loggerObject

Returns the value of attribute logger

Returns:

  • (Object)

    the current value of logger



6
7
8
# File 'lib/pg_failover/config.rb', line 6

def logger
  @logger
end

#max_retriesObject

Returns the value of attribute max_retries

Returns:

  • (Object)

    the current value of max_retries



6
7
8
# File 'lib/pg_failover/config.rb', line 6

def max_retries
  @max_retries
end

#throttle_intervalObject

Returns the value of attribute throttle_interval

Returns:

  • (Object)

    the current value of throttle_interval



6
7
8
# File 'lib/pg_failover/config.rb', line 6

def throttle_interval
  @throttle_interval
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/pg_failover/config.rb', line 23

def enabled?
  self[:enabled] ||= %w[1 t true].include?(ENV['POSTGRES_FAILOVER_ENABLED'])
end

#throttle_enabled?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/pg_failover/config.rb', line 15

def throttle_enabled?
  !throttle_interval.zero?
end