Sha256: 2620c844ed99d4fc1f7caa839cd2486f572ff8d69ef5bcd26a928d70890b4a3c

Contents?: true

Size: 652 Bytes

Versions: 1

Compression:

Stored size: 652 Bytes

Contents

module Hcheck
  module Checks
    # postgresql check module
    # implements status
    # include postgresql check dependencies
    module Postgresql
      # @config { host, port, options, tty, dbname, user, password }
      def status(config)
        config[:user] = config.delete(:username) if config[:username]
        config[:dbname] = config.delete(:database) if config[:database]

        PG::Connection.new(config).close
        'ok'
      rescue PG::ConnectionBad => e
        Hcheck.logger.error "[HCheck] PG::ConnectionBad #{e.message}"
        'bad'
      end

      def self.included(_base)
        require 'pg'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hcheck-0.1.0 lib/hcheck/checks/postgresql.rb