Class: Clerk::Config
- Inherits:
-
Object
- Object
- Clerk::Config
- Defined in:
- lib/clerk.rb
Constant Summary collapse
- PRODUCTION_BASE_URL =
"https://api.clerk.dev/v1/".freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#excluded_routes ⇒ Object
An array of route paths on which the middleware will not execute.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#middleware_cache_store ⇒ Object
Returns the value of attribute middleware_cache_store.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/clerk.rb', line 45 def initialize @base_url = ENV.fetch("CLERK_API_BASE", PRODUCTION_BASE_URL) @api_key = ENV["CLERK_API_KEY"] secret_key = ENV["CLERK_SECRET_KEY"] if secret_key && !secret_key.empty? @api_key = secret_key end @excluded_routes = [] end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
20 21 22 |
# File 'lib/clerk.rb', line 20 def api_key @api_key end |
#base_url ⇒ Object
Returns the value of attribute base_url.
20 21 22 |
# File 'lib/clerk.rb', line 20 def base_url @base_url end |
#excluded_routes ⇒ Object
An array of route paths on which the middleware will not execute.
Only request paths that match exactly one of the routes will be skipped. As a special case, if a route ends with ‘/*’, then all request paths that match the route’s prefix will be skipped.
For example, given the following configuration:
excluded_routes = ["/foo", "/bar/*"]
the following requests will be excluded:
-
/foo
-
/bar/baz
-
/bar/abc/xyz
while the following requests will NOT be excluded:
-
/foo/bar
-
/bar
43 44 45 |
# File 'lib/clerk.rb', line 43 def excluded_routes @excluded_routes end |
#logger ⇒ Object
Returns the value of attribute logger.
20 21 22 |
# File 'lib/clerk.rb', line 20 def logger @logger end |
#middleware_cache_store ⇒ Object
Returns the value of attribute middleware_cache_store.
20 21 22 |
# File 'lib/clerk.rb', line 20 def middleware_cache_store @middleware_cache_store end |