Class: Webhookdb::Postgres::Maintenance::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/webhookdb/postgres/maintenance.rb

Direct Known Subclasses

Command, Query

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service_integration) ⇒ Base

Returns a new instance of Base.



20
21
22
# File 'lib/webhookdb/postgres/maintenance.rb', line 20

def initialize(service_integration)
  @service_integration = service_integration
end

Instance Attribute Details

#service_integrationObject

Returns the value of attribute service_integration.



16
17
18
# File 'lib/webhookdb/postgres/maintenance.rb', line 16

def service_integration
  @service_integration
end

Instance Method Details

#conn_paramsObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/webhookdb/postgres/maintenance.rb', line 24

def conn_params
  org_uri = URI(self.service_integration.organization.admin_connection_url_raw)
  superuser_url = Webhookdb::Organization::DbBuilder.available_server_urls.find { |u| URI(u).host == org_uri.host }
  raise Webhookdb::InvalidPrecondition, "cannot find superuser url for #{org_uri.host}" if superuser_url.nil?
  sup_uri = URI(superuser_url)
  return {
    user: sup_uri.user,
    password: sup_uri.password,
    host: sup_uri.host,
    port: sup_uri.port,
    database: org_uri.path&.delete_prefix("/"),
    table: self.service_integration.table_name,
  }
end

#debug?Boolean

Returns:

  • (Boolean)


18
# File 'lib/webhookdb/postgres/maintenance.rb', line 18

def debug? = Webhookdb::Postgres::Maintenance.debug