Skip to content

VAULT_ADDR is not respected if set with ENV['VAULT_ADDR'] = 'foo' #208

Description

@rileytg
$ 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']

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions