Skip to content

Commit 678e6f4

Browse files
authored
allow to optionally pass in host env to wizer/weval (#136)
Signed-off-by: karthik2804 <karthik.ganeshram@fermyon.com>
1 parent 20cf4a2 commit 678e6f4

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

src/componentize.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,16 @@ export async function componentize(jsSource, witWorld, opts) {
158158
)
159159
);
160160

161+
let hostenv = {};
162+
163+
if (opts.env) {
164+
hostenv = (typeof opts.env === 'object')
165+
? opts.env
166+
: process.env;
167+
};
168+
161169
const env = {
170+
...hostenv,
162171
DEBUG: DEBUG_CALLS ? '1' : '',
163172
SOURCE_NAME: sourceName,
164173
IMPORT_WRAPPER_CNT: Object.keys(importWrappers).length.toString(),

types.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ interface ComponentizeOptions {
4343
* (no experimental subsystems currently supported)
4444
*/
4545
enableFeatures?: [],
46+
/**
47+
* Pass environment variables to the spawned Wizer or Weval Process If set to
48+
* true, all host environment variables are passed. To pass only a subset,
49+
* provide an object with the desired variables.
50+
*/
51+
env: boolean | Record<string, string>,
4652
}
4753

4854
/**

0 commit comments

Comments
 (0)