$ unset VAULT_ADDR
$ cat test-vault.rb
require 'vault'
ENV['VAULT_ADDR'] = 'foo'
puts Vault.address
$ ruby test-vault.rb
https://127.0.0.1:8200
Expected result is foo
I stumbled upon this because I use the dotenv-rails gem for loading project specific env variables. I suspect it's because the ENV vars are read when the gem is required.
is this an intentional design? Is there anything i can do other than run this in my setup code:
Vault.address = ENV['VAULT_ADDR']
Vault.token = ENV['VAULT_TOKEN']
Expected result is
fooI stumbled upon this because I use the dotenv-rails gem for loading project specific env variables. I suspect it's because the ENV vars are read when the gem is required.
is this an intentional design? Is there anything i can do other than run this in my setup code: