-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Support reading config vars from ENV #2090
Comments
I'm pretty sure you can set config vars from environment vars. See https://github.com/spf13/viper ... if it doesn't work, Viper is the correct repo to report issues about it. We will not create flags for all the config. |
Thank you. Apologies for not having looked at viper to work it out. |
No problem - and don't hesitate to revisit this issue if you don't get it working. |
I don't think environment variables are currently set up in hugo. Testing Adding a quick hack of
Allows me to run HUGO_TITLE='Example Title' HUGO_BASEURL='http://example.com' /Users/nic/Go/src/github.com/spf13/hugo/hugo Obviously:
|
OK, I calling |
Never mind, I misunderstood the prefix feature. That solves it. Will fix. |
So ```bash env HUGO_TITLE="Some Title" hugo server ``` Will change the `title`. Fixes gohugoio#2090
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. |
In addition to
--baseurl
, I'd like to be able to pass the site title. Other people may have use cases for other options that are normally set inconfig.toml
etc.Is this a worthy enhancement?
Command line arguments appear to be set in
[initHugoBuildCommonFlags()]
in commands/hugo.go but I can't see immediately where they're merged with the config contents.An alternative would be to use environment variables, but I don't think Hugo uses them at all.
Note: In Jekyll, I currently do this by abusing
ENV['JEKYLL_ENV']
and using{{jekyll.environment}}
(there may be a "correct" way, but I don't know it).The text was updated successfully, but these errors were encountered: