Sha256: fcf76744eb9736135eec7dbbc8c56e20af303d5048da6750cfd54f79b318c958
Contents?: true
Size: 1.97 KB
Versions: 2
Compression:
Stored size: 1.97 KB
Contents
# frozen_string_literal: true libdir = File.expand_path(File.dirname(__FILE__) + '/lib') $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) require 'dotenv/load' require 'ditty/services/logger' use Rack::CommonLogger, Ditty::Services::Logger.instance # Session use Rack::Session::Cookie, key: '_ProxES_session', path: '/', # :secure=>!TEST_MODE, # Uncomment if only allowing https:// access secret: File.read('.session_secret') # Rack Protection require 'rack/protection' use Rack::Protection::RemoteToken use Rack::Protection::SessionHijacking map '/_proxes' do require 'ditty/components/app' Ditty.component :app require 'ditty/controllers/application' Ditty::Application.set :map_path, '/_proxes' require 'omniauth' require 'omniauth/identity' OmniAuth.config.logger = Ditty::Services::Logger.instance OmniAuth.config.on_failure = proc { |env| OmniAuth::FailureEndpoint.new(env).redirect_to_failure } require 'ditty/controllers/main' require 'ditty/models/identity' use OmniAuth::Builder do # The identity provider is used by the App. provider :identity, fields: [:username], callback_path: '/auth/identity/callback', model: Ditty::Identity, on_login: Ditty::Main, on_registration: Ditty::Main, locate_conditions: ->(req) { { username: req['username'] } } end # Management App require 'proxes' Ditty.component :proxes run Rack::URLMap.new Ditty::Components.routes end map '/' do # Proxy all Elasticsearch requests require 'proxes/middleware/metrics' require 'proxes/middleware/error_handling' require 'proxes/middleware/security' require 'proxes/forwarder' # Security use ProxES::Middleware::Metrics use ProxES::Middleware::ErrorHandling use ProxES::Middleware::Security, Ditty::Services::Logger.instance unless ENV['PROXES_PASSTHROUGH'] use Rack::ContentLength # Forward requests to ES run ProxES::Forwarder.instance end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
proxes-0.9.7 | config.ru |
proxes-0.9.4 | config.ru |