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

Add option to keep empty environment variable keys in normalization #634

Closed
wants to merge 3 commits into from

Conversation

edwardrf
Copy link

In #589, the normalisation logic strips off any environment variables that does not have a value in config, however, i my use case, I am still interested in any empty environment variables names that has been set, which i'll resolve the value at a later stage, so I am implementing an naive option to allow me keep them during normalisation, please let me know if there is a better way of doing it. Currently, I have to load the project twice, use the one without normalisation to detect those empty environment variables.

@edwardrf edwardrf requested a review from ndeloof as a code owner May 31, 2024 20:54
@ndeloof
Copy link
Collaborator

ndeloof commented Jun 1, 2024

please clarify your use case. a key-only environment variable is resolved based on user's environment, and ignored otherwise. Why not just populate the project environment with all usable values ?

@edwardrf
Copy link
Author

edwardrf commented Jun 3, 2024

We use the key-only environment variable in 2 ways:

  1. Validation and suggestion: in our tool, we provide warning and suggestions to the user if there are anything in their compose file could be a mistake.
  2. Supply values when needed: our tool will figure out an external source for the value to be supplied at deployment time based on the users need.

The current behaviour of silently dropping them prevented us from doing either. An alternative solution is to return the dropped keys via a different way, like another return value or structured warning message.

@edwardrf
Copy link
Author

Any suggestions? I am open to an alternative approach if there is a recommendation.

@ndeloof
Copy link
Collaborator

ndeloof commented Jul 4, 2024

Actually this is a bug to remove empty variable from container environment, as empty has a special meaning to "remove" variable (see docker/compose#11962)

@ndeloof
Copy link
Collaborator

ndeloof commented Jul 8, 2024

Closing as #654 has been merged

@ndeloof ndeloof closed this Jul 8, 2024
@edwardrf
Copy link
Author

edwardrf commented Jul 8, 2024

Thank you!

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

3 participants