NOTE This repo is archived. This is still available under the licensing terms, but is not being actively developed or updated any further. Please see DelineaXPM for active projects.
Vault will initialize easily if the following environment variables are defined:
TSS_USERNAME
TSS_PASSWORD
TSS_TENANT
require 'vault'
# initialize from ENV variables
server = Server.new({
username: ENV['TSS_USERNAME'].to_s,
password: ENV['TSS_PASSWORD'],
tenant: ENV['TSS_TENANT']
})
begin
secret = Server::Secret.fetch(@server, 1)
rescue AccessDeniedException
puts "Whoops, looks like we're unauthorized"
rescue Exception => e
puts "Something went wrong: #{e.to_s}"
end
puts "The password is: #{secret["data"]["password"]}"