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 helper to read environment variables #32

Merged
merged 1 commit into from
Mar 9, 2017
Merged

Conversation

brikis98
Copy link
Member

@brikis98 brikis98 commented Mar 8, 2017

In a previous PR, I added a helper to set environment variables when using the shell helper or hooks. 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 the shell helper and with hooks.

@@ -202,10 +202,14 @@ hooks:
- command: <CMD>
args:
- <ARG>
env:
<KEY>: <VALUE>
Copy link
Member Author

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.
Copy link
Member Author

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

Copy link
Contributor

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.

@brikis98
Copy link
Member Author

brikis98 commented Mar 9, 2017

Merging this now.

@brikis98 brikis98 merged commit 4dedbb1 into master Mar 9, 2017
@brikis98 brikis98 deleted the env-var-helper branch March 9, 2017 12:42
Copy link
Contributor

@josh-padnick josh-padnick left a 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.
Copy link
Contributor

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.

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

2 participants