Class: Stitches::Configuration
- Inherits:
-
Object
- Object
- Stitches::Configuration
- Defined in:
- lib/stitches/configuration.rb
Defined Under Namespace
Classes: NonNullString, UnsetString
Instance Attribute Summary collapse
-
#allowlist_regexp ⇒ Object
A RegExp that allows 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.
- #whitelist_regexp=(new_allowlist_regexp) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 |
# File 'lib/stitches/configuration.rb', line 6 def initialize reset_to_defaults! end |
Instance Attribute Details
#allowlist_regexp ⇒ Object
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.
20 21 22 |
# File 'lib/stitches/configuration.rb', line 20 def allowlist_regexp @allowlist_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
34 35 36 |
# File 'lib/stitches/configuration.rb', line 34 def custom_http_auth_scheme @custom_http_auth_scheme.to_s end |
#custom_http_auth_scheme=(new_custom_http_auth_scheme) ⇒ Object
38 39 40 |
# File 'lib/stitches/configuration.rb', line 38 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
54 55 56 |
# File 'lib/stitches/configuration.rb', line 54 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
58 59 60 |
# File 'lib/stitches/configuration.rb', line 58 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.
46 47 48 |
# File 'lib/stitches/configuration.rb', line 46 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
50 51 52 |
# File 'lib/stitches/configuration.rb', line 50 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! @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") end |
#whitelist_regexp=(new_allowlist_regexp) ⇒ Object
28 29 30 31 |
# File 'lib/stitches/configuration.rb', line 28 def whitelist_regexp=(new_allowlist_regexp) self.allowlist_regexp = new_allowlist_regexp warn("⚠️ 'whitelist' is deprecated in stitches configuration, please use 'allowlist' or auto-update with:\n\n bin/rails g stitches:update_configuration\n\n⚠️ 'whitelist' will be removed in 4.0") end |