finch icon indicating copy to clipboard operation
finch copied to clipboard

fix: add stricter check for DOCKER_CONFIG var

Open pendo324 opened this issue 2 years ago • 1 comments

Signed-off-by: Justin Alvarez [email protected]

Issue #, if available: Closes #126

Description of changes:

  • Previously, this code was just checking for any substring containing export DOCKER_CONFIG, now we check for a line starting with the fully configured DOCKER_CONFIG variable (like export DOCKER_CONFIG="/Users/justin/.finch")

Testing done:

  • added unit test for this scenario

  • I want to test this practically, but its difficult to change the user on my mac and keep the same VM. Thinking of ways to test before merging

  • [x] I've reviewed the guidance in CONTRIBUTING.md

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

pendo324 avatar Dec 20 '22 00:12 pendo324

@pendo324 I was wondering if it would simplify things if the DOCKER_CONFIG variable was passed in as a Env variable in the lima config? Similar to https://github.com/runfinch/finch/pull/129

ollypom avatar Dec 22 '22 11:12 ollypom

@pendo324 I was wondering if it would simplify things if the DOCKER_CONFIG variable was passed in as a Env variable in the lima config? Similar to #129

Sorry for the late response @ollypom, I was out for the holidays and I'm still catching up on things. I believe I tried this before but wasn't able to get it working because of the fact that the DOCKER_CONFIG is dependent on the $USER (since it's set to /Users/$USER/.finch).

Some of this complication is due to the fact that the Lima env map adds to /etc/environment, which can't evaluate variables, by definition.

It's definitely possible that I overlooked something though, open to changing this behavior as its kinda hacky the way it is currently. The other advantage of the way it is right now is that its dynamically evaluated on vm init, which means it will get updated in the rare case that the $USER changes (which is pretty hard to test actually, which is the reason I haven't tried to merge this yet).

pendo324 avatar Jan 05 '23 19:01 pendo324

Deduping for all strings added to bashrc was already added by a separate PR (see here), closing

pendo324 avatar Mar 13 '24 21:03 pendo324