Class: Stitches::Configuration
- Inherits:
-
Object
- Object
- Stitches::Configuration
show all
- Defined in:
- lib/stitches/configuration.rb
Defined Under Namespace
Classes: NonNullInteger, NonNullString, UnsetString
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
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.
22
23
24
|
# File 'lib/stitches/configuration.rb', line 22
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
31
32
33
|
# File 'lib/stitches/configuration.rb', line 31
def custom_http_auth_scheme
@custom_http_auth_scheme.to_s
end
|
#custom_http_auth_scheme=(new_custom_http_auth_scheme) ⇒ Object
35
36
37
|
# File 'lib/stitches/configuration.rb', line 35
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
51
52
53
|
# File 'lib/stitches/configuration.rb', line 51
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
55
56
57
|
# File 'lib/stitches/configuration.rb', line 55
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.
43
44
45
|
# File 'lib/stitches/configuration.rb', line 43
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
47
48
49
|
# File 'lib/stitches/configuration.rb', line 47
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 ⇒ Object
67
68
69
|
# File 'lib/stitches/configuration.rb', line 67
def max_cache_size
@max_cache_size.to_i
end
|
#max_cache_size=(new_max_cache_size) ⇒ Object
71
72
73
|
# File 'lib/stitches/configuration.rb', line 71
def max_cache_size=(new_max_cache_size)
@max_cache_size = NonNullInteger.new("max_cache_size", new_max_cache_size)
end
|
#max_cache_ttl ⇒ Object
59
60
61
|
# File 'lib/stitches/configuration.rb', line 59
def max_cache_ttl
@max_cache_ttl.to_i
end
|
#max_cache_ttl=(new_max_cache_ttl) ⇒ Object
63
64
65
|
# File 'lib/stitches/configuration.rb', line 63
def max_cache_ttl=(new_max_cache_ttl)
@max_cache_ttl = NonNullInteger.new("max_cache_ttl", new_max_cache_ttl)
end
|
#reset_to_defaults! ⇒ Object
Mainly for testing, this resets all configuration to the default value
11
12
13
14
15
16
17
18
|
# 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)
end
|