-
Notifications
You must be signed in to change notification settings - Fork 9
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 helper to read environment variables #32
Conversation
@@ -202,10 +202,14 @@ hooks: | |||
- command: <CMD> | |||
args: | |||
- <ARG> | |||
env: | |||
<KEY>: <VALUE> |
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.
Note: in the previous PR, I made my docs changes to the root README file. I forgot that in this repo, the README in the root folder is actually generated from the _docs
folder, so I've had to redo those doc changes in the proper place in this PR :)
* `templateFolder`: Return the value of the `--template-folder` command-line option. Useful for building relative paths. | ||
* `outputFolder`: Return the value of the `--output-folder` command-line option. Useful for building relative paths. | ||
|
||
* `env NAME DEFAULT`: Render the value of environment variable `NAME`. If that environment variable is empty or not | ||
defined, render `DEFAULT` instead. |
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.
This is the only change to the docs that's relevant for this PR
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.
+1 on implementing a getOrElse()
here.
Merging this now. |
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.
Thanks for adding this!
* `templateFolder`: Return the value of the `--template-folder` command-line option. Useful for building relative paths. | ||
* `outputFolder`: Return the value of the `--output-folder` command-line option. Useful for building relative paths. | ||
|
||
* `env NAME DEFAULT`: Render the value of environment variable `NAME`. If that environment variable is empty or not | ||
defined, render `DEFAULT` instead. |
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.
+1 on implementing a getOrElse()
here.
In a previous PR, I added a helper to set environment variables when using the
shell
helper orhooks
. This PR adds a helper to read environment variables. The nice thing is that these helpers are composable: that is, you can use the helper to read env vars both with theshell
helper and withhooks
.