Class: Myrr::Configuration
- Inherits:
-
Object
- Object
- Myrr::Configuration
- Defined in:
- lib/myrr/configuration.rb
Overview
Configuration for the myrr-rb gem.
In its default (Port) state the gem requires zero configuration.
Token counting on text/markdown responses and the
X-Token-Count header are active out of the box.
Additional attributes exist for the opt-in identity and pay layers (not auto-loaded — require explicitly).
Instance Attribute Summary collapse
-
#auto_format_md ⇒ Boolean
When true, the identity middleware auto-selects
:mdformat when an agent is detected and no explicit format is set. -
#fail_open ⇒ Boolean
When true (default), requests proceed when identity verification fails (logging a warning).
-
#identity_adapter ⇒ Proc?
Optional lambda that replaces protocol server calls for identity verification.
-
#open_timeout ⇒ Integer
HTTP open timeout in seconds.
-
#protocol_server_url ⇒ String?
URL of the Myrr protocol server (e.g. "http://localhost:8080").
-
#read_timeout ⇒ Integer
HTTP read timeout in seconds.
-
#site_api_key ⇒ String?
API key for authenticating with the protocol server.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/myrr/configuration.rb', line 47 def initialize # Identity-layer defaults (nil / conservative — opt-in only) @protocol_server_url = nil @site_api_key = nil @identity_adapter = nil @fail_open = true @auto_format_md = false @open_timeout = 5 @read_timeout = 10 end |
Instance Attribute Details
#auto_format_md ⇒ Boolean
When true, the identity middleware auto-selects :md format when
an agent is detected and no explicit format is set.
Default is false (port mode does not negotiate format).
37 38 39 |
# File 'lib/myrr/configuration.rb', line 37 def auto_format_md @auto_format_md end |
#fail_open ⇒ Boolean
When true (default), requests proceed when identity verification fails (logging a warning). When false, returns 502 Bad Gateway.
31 32 33 |
# File 'lib/myrr/configuration.rb', line 31 def fail_open @fail_open end |
#identity_adapter ⇒ Proc?
Optional lambda that replaces protocol server calls for identity
verification. Receives a did:myrr: string, returns a hash with
did_key, status, and optional owner, or nil.
26 27 28 |
# File 'lib/myrr/configuration.rb', line 26 def identity_adapter @identity_adapter end |
#open_timeout ⇒ Integer
HTTP open timeout in seconds.
41 42 43 |
# File 'lib/myrr/configuration.rb', line 41 def open_timeout @open_timeout end |
#protocol_server_url ⇒ String?
URL of the Myrr protocol server (e.g. "http://localhost:8080"). Required when using the identity or pay layers.
16 17 18 |
# File 'lib/myrr/configuration.rb', line 16 def protocol_server_url @protocol_server_url end |
#read_timeout ⇒ Integer
HTTP read timeout in seconds.
45 46 47 |
# File 'lib/myrr/configuration.rb', line 45 def read_timeout @read_timeout end |
#site_api_key ⇒ String?
API key for authenticating with the protocol server.
20 21 22 |
# File 'lib/myrr/configuration.rb', line 20 def site_api_key @site_api_key end |