-
-
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
Allow setting the delimiter used for setting config via OS env, e.g. HUGO_ #7829
Comments
The underlying limitation:
If you want to be able to override configuration values with environment variables, define the configuration variables using camelCase instead of snake_case. The OP worked around this limitation by setting an environment variable to a JSON string, but that introduced unwanted side effects (unmarshal produces float64 regardless of number format). |
Using camelCase sounds like a good idea for future projects. But this doesn't really help people relying on a 3rd party theme! |
So, the recasting is done by Go's So,
|
How should I structure the YAML input? Standard YAML uses line breaks. Will |
Not elegant, but this works to pass YAML in a Bash shell:
Resulting values and types:
|
OK, I stumbled upon this problem myself ... I will test this, but I suggest that we allow the user setting the delimiter to be used as the first character after
|
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. |
Issue
Hugo lets the user inject single values into the configuration by using
HUGO_PARAMS_<paremeterName>=<value> hugo
. If more than one parameter, or a parameter with an underscore in the name, needs to be injected, this has to be done by injecting the entire section, e.g.HUGO_PARAMS_<sectionName>=<JSONstring> hugo
. When injecting integers, that would be typeint64
when defined in the config files, they are recast to typefloat64
.Example
In
/config/default_/params.toml
:In order to change the parameters we need to inject a
JSON
string.After injection
param_INT
is typefloat64
and notint64
.Hugo version
v0.76.4
The text was updated successfully, but these errors were encountered: