'Vault ruby on rails giving ssl connection error

I have one project we are using vautl I am using it for local development, Where Rails s working fine.

But when I want to run rails c console it give me following error

/Users/xyz/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/net/protocol.rb:44:in `connect_nonblock': SSL_connect returned=1 errno=0 state=error: wrong version number (OpenSSL::SSL::SSLError)
    from /Users/xyz/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/net/protocol.rb:44:in `ssl_socket_connect'
    from /Users/xyz/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/net/http.rb:996:in `connect'
    from /Users/xyz/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/net/http.rb:930:in `do_start'
    from /Users/xyz/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/net/http.rb:925:in `start'
    from /Users/xyz/.rvm/gems/ruby-2.6.6@bb-rails/gems/vault-0.15.0/lib/vault/persistent.rb:698:in `start'

I have following class in `lib/utils/vault_config.rb

class VaultConfig
  def self.read(path)
    Vault.configure do |config|
      config.address = "http://127.0.0.1:8200"
      config.token = "my_tooken"
      config.ssl_verify = false
    end
    Vault.with_retries(Vault::HTTPConnectionError, Vault::HTTPError, attempts: 5) do
      secret = Vault.logical.read("secret/#{path}/#{Rails.env}")
      secret ||= Vault.logical.read("secret/#{path}")
      secret && OpenStruct.new(secret.data)
    end
  end
end

I am running vault development instance and it is in http not https and as it is for development only. So how can make sure rails c should not use ssl.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source