|
|
|
@ -43,16 +43,6 @@ module Carto
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def do_metadata_connection()
|
|
|
|
|
configuration = get_metadata_db_configuration()
|
|
|
|
|
$pool.fetch(configuration) do
|
|
|
|
|
get_database_without_search_path(configuration)
|
|
|
|
|
end
|
|
|
|
|
rescue StandardError => exception
|
|
|
|
|
CartoDB::report_exception(exception, "Cannot connect to DO Metadata database")
|
|
|
|
|
raise exception
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def get_database(options, configuration)
|
|
|
|
@ -150,18 +140,6 @@ module Carto
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def get_metadata_db_configuration()
|
|
|
|
|
do_configuration = Cartodb.config[:do_metadata_database]
|
|
|
|
|
configuration = get_db_configuration_for(do_configuration['host'], do_configuration['database'], {})
|
|
|
|
|
configuration.merge(do_configuration)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def get_database_without_search_path(configuration)
|
|
|
|
|
resolver = ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver.new([])
|
|
|
|
|
ActiveRecord::Base.connection_handler.establish_connection(
|
|
|
|
|
get_connection_name(:do_metadata_connection), resolver.spec(configuration)
|
|
|
|
|
).connection
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|