Open aharpervc opened 6 years ago
You can do this by separating these into multiple files, and configuring consult.yml
to render the appropriate file for your environment.
Yes, but that adds an administrative burden of managing multiple templates. I was thinking something along the lines of this might be useful:
development:
username: fake
password: hardcoded
production:
<% with secret "secret/data/database_credentials", only: :production do |s| %>
username: <%= s.data.dig(:data, :username) %>
password: <%= s.data.dig(:data, :password) %>
<% end %>
Given a template file that references consul or vault key paths for staging or production, but not development, I would still like this template file to be rendered for disconnected local development.
Currently, you'll get an unhandled exception when the relevant template helper is called. For example, I would like this to work fine in development:
https://github.com/veracross/consult/blob/9354c09b51cb7397ae1dfc08858572e040f19ff7/lib/consult/template_functions.rb#L12-L14
Perhaps this could be done with an env-specific consult.yml config option that says "allow render on fail", which would be falsey by default but that you could set to true for development, if you wanted.