-
Notifications
You must be signed in to change notification settings - Fork 48
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
Sourcing Environment Variables From Hooks #60
Conversation
Whoops, I'm kinda new to the UI of PRs hehe. Not sure how to undo this mark |
Looked through the code a bit, I don't really know much about pipes so I'm not sure if this is the best way to implement this. This is definitely on the path to getting merged - figuring out windows support (or deciding against it) is an important point though. |
TIL you can drop values like this -- much cleaner. Co-authored-by: SuperCuber <hubtig@amitgold.com>
Out of all the inter-process communication methods, pipes tick quite a few boxes for being useful here:
Of course, not trying to say that pipes are the be-all-end-all. I would like to at least move away from anonymous pipes and into named pipes; this would resolve the issue of a script using FD3 as a hard-coded value (it's not too uncommon). The I'll do a bit of research on this front and report back / update implementation if I find compelling evidence for using any particular communication method. Open to suggestions. |
Sorry for no update on this in a long time... school is sucking up all of my time. I've been thinking about this a little bit more. Is there any reason not to just have additional shell expansion syntax? I don't see why |
This is already kinda planned in #61 - if we add full handlebars rendering, then you can use the command_output helper for this. Now that I'm thinking about it, #61 would also make the functionality in #52 redundant - since you can just make the path render to an empty string to disable the file. I'm not sure however how this addresses the use case in the pull request though... Maybe I'm misunderstanding something. |
Hey, the CI went through some changes to make sure it works for older versions of Linux. When/if you continue working on this make sure you merge the changes from master to your branch and re-run the CI (I might need to re-approve it) |
With recent Firefox updates, I no longer need this for the exact use-case that I'm after. While I still think this may be useful, I am no longer interested in putting in work towards the solution. |
Closes #57
Description
This PR allows for setting environment variables within
pre_deploy
andpre_undeploy
files, which will then be taken in for the current process.Use Example
Say we have the following snippet within a
global.toml
file:Before this PR, one would need to export
$MAGIC_DIR
before running. Now, one can have the followingpre_deploy.sh
:This will now be shell expanded correctly.
Implementation
Modifications here are done as follow:
pre_deploy
, sourcing the contentsThe sourcing is roughly done as follows:
FD
sh
call assh -c "source pre_deploy.sh"; printenv -0 >&FD
FD
, parsing the output as environment variable pairsstd::env::set_var
to forward the child's variables to usTODO
This PR will be feature-complete when the following is done:
I have yet to find a way to
source
environment variables within windows batch files. And given that I don't run windows, it will be a good bit of time before I were to write and test this on my own. Ideas on this point are welcome.