secret
Created

  • Download Gist
recipe1.rb
Ruby
1 2 3 4 5 6 7
secret_path = Pathname(node["my-recipe"]["secret"]["path"])
if secret_path.exist?
secret = secret_path.read
else
secret = new_secret
secret_path.open{|f| f.write(secret)}
end
recipe2.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11
secret_path = Pathname(node["my-recipe"]["secret"]["path"])
if secret_path.exist?
secret = secret_path.read
else
# should never get here
raise StandardError, "secret path is missing"
end
 
template "/etc/my-app.conf" do
variables :secret => secret
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.