Class: Typesensual::Config
- Inherits:
-
Object
- Object
- Typesensual::Config
- Defined in:
- lib/typesensual/config.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize {|_self| ... } ⇒ Config
Returns a new instance of Config.
7 8 9 |
# File 'lib/typesensual/config.rb', line 7 def initialize(&block) yield self if block end |
Instance Attribute Details
#api_key ⇒ Object
26 27 28 |
# File 'lib/typesensual/config.rb', line 26 def api_key @api_key ||= ENV.fetch('TYPESENSUAL_API_KEY', nil) end |
#client ⇒ Object
15 16 17 |
# File 'lib/typesensual/config.rb', line 15 def client @client ||= Typesense::Client.new() end |
#env ⇒ Object
11 12 13 |
# File 'lib/typesensual/config.rb', line 11 def env @env ||= ENV.fetch('TYPESENSUAL_ENV', (defined?(Rails) ? Rails.env : nil)) end |
#nodes ⇒ Object
19 20 21 22 23 24 |
# File 'lib/typesensual/config.rb', line 19 def nodes @nodes ||= ENV['TYPESENSUAL_NODES']&.split(',')&.map do |node| node_uri = URI.parse(node) { port: node_uri.port, host: node_uri.host, protocol: node_uri.scheme } end end |