Class: OpenReceive::Server::Config
- Inherits:
-
Object
- Object
- OpenReceive::Server::Config
- Defined in:
- lib/openreceive/server/config.rb
Instance Attribute Summary collapse
-
#lsc_connections ⇒ Object
readonly
Returns the value of attribute lsc_connections.
-
#nwc ⇒ Object
readonly
Returns the value of attribute nwc.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(env: ENV) ⇒ Config
constructor
A new instance of Config.
- #inspect ⇒ Object
-
#swap_providers(http: nil, now: nil) ⇒ Object
FixedFloat-compatible providers for the parsed LSC connections, in env order (primary first, backup second) — the same providers the Service auto-builds when constructed without swap_providers.
- #to_h ⇒ Object
Constructor Details
#initialize(env: ENV) ⇒ Config
Returns a new instance of Config.
14 15 16 17 18 |
# File 'lib/openreceive/server/config.rb', line 14 def initialize(env: ENV) @nwc = clean(env["NWC_URI"]) @lsc_connections = OpenReceive::Server::LscUri.read_environment(env) freeze end |
Instance Attribute Details
#lsc_connections ⇒ Object (readonly)
Returns the value of attribute lsc_connections.
8 9 10 |
# File 'lib/openreceive/server/config.rb', line 8 def lsc_connections @lsc_connections end |
#nwc ⇒ Object (readonly)
Returns the value of attribute nwc.
8 9 10 |
# File 'lib/openreceive/server/config.rb', line 8 def nwc @nwc end |
Class Method Details
.load(env: ENV) ⇒ Object
10 11 12 |
# File 'lib/openreceive/server/config.rb', line 10 def self.load(env: ENV) new(env: env) end |
Instance Method Details
#inspect ⇒ Object
34 35 36 |
# File 'lib/openreceive/server/config.rb', line 34 def inspect "#<OpenReceive::Server::Config storage=none nwc=#{@nwc.nil? ? 'missing' : '[REDACTED]'}>" end |
#swap_providers(http: nil, now: nil) ⇒ Object
FixedFloat-compatible providers for the parsed LSC connections, in env order (primary first, backup second) — the same providers the Service auto-builds when constructed without swap_providers.
23 24 25 |
# File 'lib/openreceive/server/config.rb', line 23 def swap_providers(http: nil, now: nil) OpenReceive::Server::Swap.providers_from_connections(@lsc_connections, http: http, now: now) end |
#to_h ⇒ Object
27 28 29 30 31 32 |
# File 'lib/openreceive/server/config.rb', line 27 def to_h { "NWC_URI" => @nwc.nil? ? nil : "[REDACTED]", "LSC_URI_connections" => @lsc_connections.length } end |