-
Notifications
You must be signed in to change notification settings - Fork 592
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
Transforms JS SDK: plumb environ
down into process.env
#20313
Transforms JS SDK: plumb environ
down into process.env
#20313
Conversation
f1d5afb
to
dc25279
Compare
28052c1
to
76993e6
Compare
81ce854
to
9eee29f
Compare
src/transform-sdk/js/js_vm.cc
Outdated
return result; | ||
} | ||
|
||
auto process_builder = class_builder<process>(_ctx.get(), "Process"); |
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.
Can we not create a class but just make a plain object with a single property of env
? I don't see the value of a class here.
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.
- just realized dot notation can be used interchangeably with brackets for arbitrary objects 🤦
- I was thinking that people might come to expect some of the other junk offered by Process, but it won't be hard to add the class later if needed, esp. given (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.
- It took me time to realize this too. Magic of JS!
- YAGNI, but yes it's not hard to add if so
src/transform-sdk/js/js_vm.cc
Outdated
@@ -394,6 +395,50 @@ class console { | |||
FILE* _info_stream; | |||
FILE* _err_stream; | |||
}; | |||
|
|||
class process { | |||
using map_t = std::unordered_map<std::string, std::string>; |
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.
Can we add NODE_ENV=production
if there is no user environment variable set for the NODE_ENV
key?
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.
sure
9eee29f
to
784418f
Compare
force push CR |
Reflects contents of `environ` at transform init Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
784418f
to
11e1624
Compare
force push pesky |
This PR adds a
Process
class and injects an instance into the global namespace asglobalThis.process
. Currently we implement a top-levelenv
object that reflects the contents ofenviron
at init time, but in principle this could take on other process stuff.Backports Required
Release Notes