-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
parent env can override pantry runtime env #1115
Conversation
If the runtime env does not recurse its key, parent env overrides. Eg. SSL_CERT_FILE={{prefix}}, if the parent env sets SSL_CERT_FILE then it persists. Most runtime env recurses, eg. PYTHONPATH={{prefix}}/lib/python:$PYTHONPATH, and in such cases the parent env is inserted (this is unchanged behavior). Fixes #1101
$ pkgx +curl.se/ca-certs
SSL_CERT_FILE="${SSL_CERT_FILE:-/Users/mxcl/.pkgx/curl.se/ca-certs/v2024.12.31/ssl/cert.pem}"
$ pkgx +curl.se/ca-certs -- env
SSL_CERT_FILE=/Users/mxcl/.pkgx/curl.se/ca-certs/v2024.12.31/ssl/cert.pem
$ SSL_CERT_FILE=foo pkgx +curl.se/ca-certs -- env
SSL_CERT_FILE=foo
$ eval "$(pkgx +curl.se/ca-certs)"
$ echo $SSL_CERT_FILE
/Users/mxcl/.pkgx/curl.se/ca-certs/v2024.12.31/ssl/cert.pem
$ SSL_CERT_FILE=foo
$ eval "$(pkgx +curl.se/ca-certs)"
$ echo $SSL_CERT_FILE
foo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hairy, but it doesn't look wrong.
Yeah I hate using magic strings like this, but I am not fresh enough at 1am Friday to do better. |
More interested in if you think the behavior is right or if I'm missing something. |
I think the problem for certain keys is they're not arrayable by default. Most of the ones we set are, but I believe this one isn't. So, you have to decide which values to trust. |
The pantry |
If the runtime env does not recurse its key, parent env overrides.
Eg. SSL_CERT_FILE={{prefix}}, if the parent env sets SSL_CERT_FILE then it persists.
Most runtime env recurses, eg. PYTHONPATH={{prefix}}/lib/python:$PYTHONPATH, and in such cases the parent env is inserted (this is unchanged behavior).
Fixes #1101