Sha256: 097aaa81309941eb26cf782a872f60c6978569c65562e5bc8079e26df20fd5d4
Contents?: true
Size: 1.58 KB
Versions: 22
Compression:
Stored size: 1.58 KB
Contents
# encoding: UTF-8 # # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. require_relative 'base_middleware' require 'gooddata_datawarehouse' if RUBY_PLATFORM == 'java' module GoodData module Bricks # Connects to the warehouse (ADS) and enriches parameters with GoodData::Datawarehouse class WarehouseMiddleware < Bricks::Middleware def call(params) if params.key?('ads_client') GoodData.logger.info "Setting up ADS connection to #{params['ads_client']['ads_id'] || params['ads_client']['jdbc_url']}" unless params['ads_client']['username'] || params['GDC_USERNAME'] raise "ADS middleware needs username either as part of " \ "ads_client spec or as a global 'GDC_USERNAME' parameter" end unless params['ads_client']['password'] || params['GDC_PASSWORD'] raise "ADS middleware needs password either as part of " \ "ads_client spec or as a global 'GDC_PASSWORD' parameter" end ads = GoodData::Datawarehouse.new( params['ads_client']['username'] || params['GDC_USERNAME'], params['ads_client']['password'] || params['GDC_PASSWORD'], params['ads_client']['ads_id'], jdbc_url: params['ads_client']['jdbc_url'] ) @app.call(params.merge('ads_client' => ads, :ads_client => ads)) else @app.call(params) end end end end end
Version data entries
22 entries across 22 versions & 1 rubygems