-
Notifications
You must be signed in to change notification settings - Fork 840
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
!env
for respecting environment variables from the configuration file#1524
Conversation
env_var_content = ""; | ||
|
||
free(node->data.scalar); | ||
node->data.scalar = h2o_strdup(NULL, env_var_content, SIZE_MAX).base; |
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.
what is the reason the pointer from getenv
cant be assigned directly to node->data.scalar
?
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.
Because node->data.scalar
eventually gets free
d in yoml_free
.
Q: should we allow a default value? if so how, just |
Could you please elaborate what you mean by "default"? To me the current code that uses an empty string upon the absence the environment variable seems sufficient to me. |
@kazuho one could catch the null and then set the variable to a default that was supplied. Like If you think thats useless im fine as is. Use case for me would be to simplify deployment of mini services in containers |
@yannick Sorry for the belated response.
We could do that, but the syntax could be an issue. Personally I'd prefer using a syntax similar to bash (e.g., What do you think? Alternatively, we could leave default value support to another PR. |
@kazuho i am fine with this idea. i'd say we leave it as is and if i manage i'll do a 2nd pr to add defaults. |
Thank you for working on the PR. The changes have been merged to master. |
!env
for respecting environment variables from the configuration file
implements #1520 , replaces #1519