Class: Stitches::Configuration
- Inherits:
-
Object
- Object
- Stitches::Configuration
- Defined in:
- lib/stitches/configuration.rb
Defined Under Namespace
Classes: NonNullString, UnsetString
Instance Attribute Summary collapse
-
#whitelist_regexp ⇒ Object
A RegExp that whitelists URLS around the mime type and api key requirements.
Instance Method Summary collapse
-
#custom_http_auth_scheme ⇒ Object
The name of your custom http auth scheme.
- #custom_http_auth_scheme=(new_custom_http_auth_scheme) ⇒ Object
- #env_var_to_hold_api_client ⇒ Object
- #env_var_to_hold_api_client=(new_env_var_to_hold_api_client) ⇒ Object
-
#env_var_to_hold_api_client_primary_key ⇒ Object
The name of the environment variable that the ApiKey middleware should use to place the primary key of the authenticated ApiKey.
- #env_var_to_hold_api_client_primary_key=(new_env_var_to_hold_api_client_primary_key) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#reset_to_defaults! ⇒ Object
Mainly for testing, this resets all configuration to the default value.
Constructor Details
#initialize ⇒ Configuration
6 7 8 |
# File 'lib/stitches/configuration.rb', line 6 def initialize reset_to_defaults! end |
Instance Attribute Details
#whitelist_regexp ⇒ Object
A RegExp that whitelists URLS around the mime type and api key requirements. nil means that ever request must have a proper mime type and api key.
20 21 22 |
# File 'lib/stitches/configuration.rb', line 20 def whitelist_regexp @whitelist_regexp end |
Instance Method Details
#custom_http_auth_scheme ⇒ Object
The name of your custom http auth scheme. This must be set, and has no default
29 30 31 |
# File 'lib/stitches/configuration.rb', line 29 def custom_http_auth_scheme @custom_http_auth_scheme.to_s end |
#custom_http_auth_scheme=(new_custom_http_auth_scheme) ⇒ Object
33 34 35 |
# File 'lib/stitches/configuration.rb', line 33 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 ⇒ Object
49 50 51 |
# File 'lib/stitches/configuration.rb', line 49 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) ⇒ Object
53 54 55 |
# File 'lib/stitches/configuration.rb', line 53 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 ⇒ Object
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.
41 42 43 |
# File 'lib/stitches/configuration.rb', line 41 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) ⇒ Object
45 46 47 |
# File 'lib/stitches/configuration.rb', line 45 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 |
#reset_to_defaults! ⇒ Object
Mainly for testing, this resets all configuration to the default value
11 12 13 14 15 16 |
# File 'lib/stitches/configuration.rb', line 11 def reset_to_defaults! @whitelist_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") end |