Avoid trailing colon when prepending to optional env vars#1645
Merged
Conversation
47c19d5 to
f820b5e
Compare
Malax
approved these changes
Sep 30, 2024
When prepending a value to an env var that uses a delimiter,
the delimiter should not be added when the env var wasn't
previously set.
To achieve this we use the ${var:+VALUE_IF_SET} parameter
expansion feature. See:
https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
f820b5e to
1fe08b0
Compare
Merged
runesoerensen
added a commit
to heroku/heroku-buildpack-dotnet
that referenced
this pull request
Nov 30, 2024
When appending or prepending env vars we should only add a colon delimiter if the env var is set. We print the literal parameter expansion statement so the statement is evaluated when the `profile.d` script is evaluated. Also see heroku/heroku-buildpack-python#1645
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When prepending a value to an env var that uses a delimiter, the delimiter should not be added when the env var wasn't previously set.
To achieve this we use the
${var:+VALUE_IF_SET}parameter expansion feature. See:https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
GUS-W-16864019.