Class: Hanko::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/hanko/configuration.rb

Overview

Holds configuration options for the Hanko SDK.

Set values via configure or pass them directly to Hanko::Client#initialize.

Examples:

Hanko.configure do |c|
  c.api_url  = "https://example.hanko.io"
  c.api_key  = "your-api-key"
  c.timeout  = 10
end

Constant Summary collapse

ATTRIBUTES =
i[
  api_url api_key timeout open_timeout retry_count
  clock_skew jwks_cache_ttl logger log_level
].freeze

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Creates a new Configuration with sensible defaults.



43
44
45
46
47
48
49
50
# File 'lib/hanko/configuration.rb', line 43

def initialize
  @timeout = 5
  @open_timeout = 2
  @retry_count = 1
  @clock_skew = 0
  @jwks_cache_ttl = 3600
  @log_level = :info
end

Instance Method Details

#inspectString

Returns a human-readable representation with the API key redacted.

Returns:

  • (String)


55
56
57
58
59
60
61
62
# File 'lib/hanko/configuration.rb', line 55

def inspect
  attrs = ATTRIBUTES.map do |key|
    value = send(key)
    value = '[REDACTED]' if key == :api_key && value
    "#{key}=#{value.inspect}"
  end
  "#<#{self.class} #{attrs.join(', ')}>"
end