Skip to content

Avoid trailing colon when prepending to optional env vars#1645

Merged
edmorley merged 1 commit intomainfrom
env-vars-trailing-colon
Sep 30, 2024
Merged

Avoid trailing colon when prepending to optional env vars#1645
edmorley merged 1 commit intomainfrom
env-vars-trailing-colon

Conversation

@edmorley
Copy link
Copy Markdown
Member

@edmorley edmorley commented 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

GUS-W-16864019.

@edmorley edmorley self-assigned this Sep 30, 2024
@edmorley edmorley force-pushed the env-vars-trailing-colon branch from 47c19d5 to f820b5e Compare September 30, 2024 08:30
@edmorley edmorley marked this pull request as ready for review September 30, 2024 08:38
@edmorley edmorley requested a review from a team as a code owner September 30, 2024 08:38
Base automatically changed from rm-vendor-dir to main September 30, 2024 08:41
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
@edmorley edmorley force-pushed the env-vars-trailing-colon branch from f820b5e to 1fe08b0 Compare September 30, 2024 08:42
@edmorley edmorley enabled auto-merge (squash) September 30, 2024 08:42
@edmorley edmorley merged commit e3dbc78 into main Sep 30, 2024
@edmorley edmorley deleted the env-vars-trailing-colon branch September 30, 2024 09:11
@heroku-linguist heroku-linguist bot mentioned this pull request Oct 1, 2024
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
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.

2 participants