Class: Webhookdb::Postgres::Maintenance::Base
- Inherits:
-
Object
- Object
- Webhookdb::Postgres::Maintenance::Base
- Defined in:
- lib/webhookdb/postgres/maintenance.rb
Instance Attribute Summary collapse
-
#service_integration ⇒ Object
Returns the value of attribute service_integration.
Instance Method Summary collapse
- #conn_params ⇒ Object
- #debug? ⇒ Boolean
-
#initialize(service_integration) ⇒ Base
constructor
A new instance of Base.
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_integration ⇒ Object
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_params ⇒ Object
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
18 |
# File 'lib/webhookdb/postgres/maintenance.rb', line 18 def debug? = Webhookdb::Postgres::Maintenance.debug |