Class: Logtide::DSN
- Inherits:
-
Object
- Object
- Logtide::DSN
- Defined in:
- lib/logtide/dsn.rb
Overview
A parsed DSN: scheme://apiKey@host[/base-path] (spec 002 section 3). The base path prefix is preserved; the ingest/OTLP suffixes are appended by the configuration, never carried here.
Constant Summary collapse
- INGEST_SUFFIX =
"/api/v1/ingest"
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(dsn) ⇒ DSN
constructor
A new instance of DSN.
Constructor Details
#initialize(dsn) ⇒ DSN
Returns a new instance of DSN.
19 20 21 22 23 24 |
# File 'lib/logtide/dsn.rb', line 19 def initialize(dsn) uri = parse_uri(dsn) validate!(uri) @api_key = uri.userinfo @base_url = build_base_url(uri) end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
13 14 15 |
# File 'lib/logtide/dsn.rb', line 13 def api_key @api_key end |
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
13 14 15 |
# File 'lib/logtide/dsn.rb', line 13 def base_url @base_url end |
Class Method Details
.parse(dsn) ⇒ Object
15 16 17 |
# File 'lib/logtide/dsn.rb', line 15 def self.parse(dsn) new(dsn) end |