-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat(variform): add a builtin function to get env vars #13507
Conversation
@@ -252,6 +252,9 @@ | |||
timezone_to_offset_seconds/1 | |||
]). | |||
|
|||
%% System functions | |||
-export([getenv/1]). |
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.
Environment variables are often used to store secrets, I would be very cautious to have a function that exposes them through the rule engine. Especially if its input may somehow by templated from the contents on MQTT message.
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.
Yes, I agree with you, but this is a customer requirement. They use environment variables to deploy EMQX, and they want to be able to pull the kafka topic from the environment variable.
In the first plan, we created a new app that allowed customization of predefined variables in placeholders. However, after review, it was considered too complex.
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.
Perhaps this function should be disabled by default, with possibility to enable it via feature flag?
Otherwise one customer's demands can create vulnerability for all EMQX users...
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.
sorry, missed this point.
will add a forced prefix instead.
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.
please send a PR to emqx-docs to document this new func. |
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.
need a namespace for the PT
Fixes EMQX-12702
Release version: v/e5.7.2
Summary
PR Checklist
Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:
changes/(ce|ee)/(feat|perf|fix|breaking)-<PR-id>.en.md
filesChecklist for CI (.github/workflows) changes
changes/
dir for user-facing artifacts update