Sha256: fa0de51beccce955b56a75835e5dfc9eb61fef64e1e3c15eabd592d08c9e2642

Contents?: true

Size: 680 Bytes

Versions: 13

Compression:

Stored size: 680 Bytes

Contents

# frozen_string_literal: true

module Orchestration
  module Services
    module Database
      class Healthcheck
        include HealthcheckBase

        dependencies 'active_record'

        def connect
          return if settings[:adapter] == 'sqlite3'

          ActiveRecord::Base.establish_connection(settings)
          ActiveRecord::Base.connection
        end

        def connection_errors
          [ActiveRecord::ConnectionNotEstablished].concat(adapter_errors)
        end

        private

        def adapter_errors
          @configuration.adapter.errors
        end

        def settings
          @configuration.settings
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
orchestration-0.5.0 lib/orchestration/services/database/healthcheck.rb
orchestration-0.4.21 lib/orchestration/services/database/healthcheck.rb
orchestration-0.4.20 lib/orchestration/services/database/healthcheck.rb
orchestration-0.4.19 lib/orchestration/services/database/healthcheck.rb
orchestration-0.4.18 lib/orchestration/services/database/healthcheck.rb
orchestration-0.4.17 lib/orchestration/services/database/healthcheck.rb
orchestration-0.4.16 lib/orchestration/services/database/healthcheck.rb
orchestration-0.4.15 lib/orchestration/services/database/healthcheck.rb
orchestration-0.4.14 lib/orchestration/services/database/healthcheck.rb
orchestration-0.4.13 lib/orchestration/services/database/healthcheck.rb
orchestration-0.4.12 lib/orchestration/services/database/healthcheck.rb
orchestration-0.4.10 lib/orchestration/services/database/healthcheck.rb
orchestration-0.4.9 lib/orchestration/services/database/healthcheck.rb