class Stitches::Configuration
Attributes
allowlist_regexp[R]
A RegExp that allows URLS around the mime type and api key requirements. nil means that ever request must have a proper mime type and api key.
disabled_key_leniency_error_log_threshold_in_seconds[RW]
disabled_key_leniency_in_seconds[RW]
Public Class Methods
new()
click to toggle source
# File lib/stitches/configuration.rb, line 6 def initialize reset_to_defaults! end
Public Instance Methods
allowlist_regexp=(new_allowlist_regexp)
click to toggle source
# File lib/stitches/configuration.rb, line 27 def allowlist_regexp=(new_allowlist_regexp) unless new_allowlist_regexp.nil? || new_allowlist_regexp.is_a?(Regexp) raise "allowlist_regexp must be a Regexp, not a #{new_allowlist_regexp.class}" end @allowlist_regexp = new_allowlist_regexp end
custom_http_auth_scheme()
click to toggle source
The name of your custom http auth scheme. This must be set, and has no default
# File lib/stitches/configuration.rb, line 35 def custom_http_auth_scheme @custom_http_auth_scheme.to_s end
custom_http_auth_scheme=(new_custom_http_auth_scheme)
click to toggle source
# File lib/stitches/configuration.rb, line 39 def custom_http_auth_scheme=(new_custom_http_auth_scheme) @custom_http_auth_scheme = NonNullString.new("custom_http_auth_scheme",new_custom_http_auth_scheme) end
env_var_to_hold_api_client()
click to toggle source
# File lib/stitches/configuration.rb, line 55 def env_var_to_hold_api_client @env_var_to_hold_api_client.to_s end
env_var_to_hold_api_client=(new_env_var_to_hold_api_client)
click to toggle source
# File lib/stitches/configuration.rb, line 59 def env_var_to_hold_api_client=(new_env_var_to_hold_api_client) @env_var_to_hold_api_client= NonNullString.new("env_var_to_hold_api_client",new_env_var_to_hold_api_client) end
env_var_to_hold_api_client_primary_key()
click to toggle source
The name of the environment variable that the ApiKey middleware should use to place the primary key of the authenticated ApiKey. For example, if a user provides the api key 1234-1234-1234-1234, and that maps to the primary key 42 in your database, the environment will contain “42” in the key provided here.
# File lib/stitches/configuration.rb, line 47 def env_var_to_hold_api_client_primary_key @env_var_to_hold_api_client_primary_key.to_s end
env_var_to_hold_api_client_primary_key=(new_env_var_to_hold_api_client_primary_key)
click to toggle source
# File lib/stitches/configuration.rb, line 51 def env_var_to_hold_api_client_primary_key=(new_env_var_to_hold_api_client_primary_key) @env_var_to_hold_api_client_primary_key = NonNullString.new("env_var_to_hold_api_client_primary_key",new_env_var_to_hold_api_client_primary_key) end
max_cache_size()
click to toggle source
# File lib/stitches/configuration.rb, line 71 def max_cache_size @max_cache_size.to_i end
max_cache_size=(new_max_cache_size)
click to toggle source
# File lib/stitches/configuration.rb, line 75 def max_cache_size=(new_max_cache_size) @max_cache_size = NonNullInteger.new("max_cache_size", new_max_cache_size) end
max_cache_ttl()
click to toggle source
# File lib/stitches/configuration.rb, line 63 def max_cache_ttl @max_cache_ttl.to_i end
max_cache_ttl=(new_max_cache_ttl)
click to toggle source
# File lib/stitches/configuration.rb, line 67 def max_cache_ttl=(new_max_cache_ttl) @max_cache_ttl = NonNullInteger.new("max_cache_ttl", new_max_cache_ttl) end
reset_to_defaults!()
click to toggle source
Mainly for testing, this resets all configuration to the default value
# File lib/stitches/configuration.rb, line 11 def reset_to_defaults! @allowlist_regexp = nil @custom_http_auth_scheme = UnsetString.new("custom_http_auth_scheme") @env_var_to_hold_api_client_primary_key = NonNullString.new("env_var_to_hold_api_client_primary_key","STITCHES_API_CLIENT_ID") @env_var_to_hold_api_client= NonNullString.new("env_var_to_hold_api_client","STITCHES_API_CLIENT") @max_cache_ttl = NonNullInteger.new("max_cache_ttl", 0) @max_cache_size = NonNullInteger.new("max_cache_size", 0) @disabled_key_leniency_in_seconds = ActiveSupport::Duration.days(3) @disabled_key_leniency_error_log_threshold_in_seconds = ActiveSupport::Duration.days(2) end