class Garage::Config
Constants
- DEFAULT_RESCUE_ERROR
Attributes
auth_server_host[RW]
auth_server_timeout[RW]
auth_server_url[RW]
cache_acceess_token_validation[W]
cast_resource[W]
docs[W]
rescue_error[W]
strategy[W]
tracer[W]
Support distributed tracing for auth server accesses.
@param [Ojbect] tracer an object which implements tracer methods. See Garage::Tracer::NullTracer
.
ttl_for_access_token_cache[RW]
Public Class Methods
new()
click to toggle source
# File lib/garage/config.rb, line 18 def initialize @cache_acceess_token_validation = false @ttl_for_access_token_cache = 5.minutes end
Public Instance Methods
cache_acceess_token_validation?()
click to toggle source
# File lib/garage/config.rb, line 63 def cache_acceess_token_validation? !!@cache_acceess_token_validation end
cast_resource()
click to toggle source
# File lib/garage/config.rb, line 51 def cast_resource @cast_resource ||= proc { |resource, options| options ||= {} to_resource_args = [options[:to_resource_options]].compact if resource.respond_to?(:map) && resource.respond_to?(:to_a) resource.map { |r| r.to_resource(*to_resource_args) } else resource.to_resource(*to_resource_args) end } end
docs()
click to toggle source
# File lib/garage/config.rb, line 47 def docs @docs ||= Docs::Config.new end
rescue_error()
click to toggle source
Set false if you want to rescue errors by yourself @return [true, false] A flag to rescue Garage::HTTPError
in ControllerHelper
(default: true) @example
Garage.configuration.rescue_error = false
# File lib/garage/config.rb, line 27 def rescue_error instance_variable_defined?(:@rescue_error) ? @rescue_error : DEFAULT_RESCUE_ERROR end
strategy()
click to toggle source
Set authentication strategy module which must satisfy Strategy
interface. @return [Module] A auth strategy. default is NoAuthentication strategy. @example
Garage.configuration.strategy = Garage::Strategy::AuthServer
# File lib/garage/config.rb, line 35 def strategy instance_variable_defined?(:@strategy) ? @strategy : Garage::Strategy::NoAuthentication end
tracer()
click to toggle source
# File lib/garage/config.rb, line 43 def tracer @tracer ||= Garage::Tracer::NullTracer end