Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable trim mode with ERB #547

Merged
merged 1 commit into from Oct 30, 2023
Merged

Conversation

nickhammond
Copy link
Contributor

This PR enables trim_mode for blank lines with <% -%> in ERB which is what's enabled in Rails so it's fairly familiar for those that have built a Rails app. trim_mode skips creating extra blank lines when there's no output which can be helpful for more complicated envify scripts, for example with AWS secrets manager. I suppose you could move this to a lib file and move some of this setup out of here but it's also not that complicated to really justify doing that. The envify command currently fails with a syntax error if you attempt to end your ERB tags with -%>.

<%
  require 'aws-sdk-secretsmanager'
  client = Aws::SecretsManager::Client.new(region: "us-west-2")
-%>

<% client.list_secrets.secret_list.each do |secret| -%>
<% value = JSON.parse(client.get_secret_value(secret_id: secret.arn).secret_string) -%>

<% value.each_pair do |k,v| -%>
<%= k %>=<%= v %>
<% end -%>
<% end -%>

@djmb djmb merged commit b732b2d into basecamp:main Oct 30, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants