class Ipfs::Connection::IpfsConfig

Constants

CONFIG_FILEPATH

Public Class Methods

new() click to toggle source
# File lib/ruby-ipfs-http-client/connection/ipfs_config.rb, line 8
def initialize
  parse_config.tap { |location|
    @host = location[:host]
    @port = location[:port]
  }
end

Private Instance Methods

parse_config() click to toggle source
# File lib/ruby-ipfs-http-client/connection/ipfs_config.rb, line 17
def parse_config
  %r{.*API.*/ip4/(.*)/tcp/(\d+)}.match(::File.read CONFIG_FILEPATH) do |matched_data|
    {
      host: matched_data[1],
      port: matched_data[2].to_i
    }
  end
end