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 a function to access environment variables in templates #977

Closed
quoha opened this issue Mar 16, 2015 · 1 comment
Closed

Add a function to access environment variables in templates #977

quoha opened this issue Mar 16, 2015 · 1 comment
Labels

Comments

@quoha
Copy link
Contributor

quoha commented Mar 16, 2015

Allow a template like {{ getenv "FOO" }} to search the user's current environment and bring in the value for $FOO. If FOO is not set or exported, expand to an empty string.

Example:

$ export FOO=world ; hugo

With template:

Hello, {{ getenv "FOO" }}

Outputs:

Hello, world
@bep bep closed this as completed in a044734 Mar 16, 2015
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
Add a wrapper for the os.Getenv function. The
wrapper takes as input a string that is assumed to be an exported
variable name.

Fixes gohugoio#977
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant