-
Notifications
You must be signed in to change notification settings - Fork 275
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
Blueprint accepting OS-level environment variable #2011
Comments
{
"steps": [
{
"step": "runPHPWithOptions",
"options": {
"code": "<?php file_put_contents('/wordpress/index.php', getenv('IS_PRODUCTION')); ?>",
"env": {
"IS_PRODUCTION": "yes"
}
}
}
]
} It would indeed be nice if the CLI had an option to accept the OS-level env variables, or if there was something in Blueprints to define env variables for the entire Playground server. I'm hesitant of just loading all the env variables by default as that would breach the OS isolation we're getting from WASM AND some variables might actually introduce problems, e.g. |
Out of curiosity – how would you use this? |
For quick tests like this: {
"steps": [
{
"step": "runPHPWithOptions",
"options": {
"code": "<?php do_something( getenv( 'VALUE_TO_TEST' ) );",
"env": {
"VALUE_TO_TEST": "The default value"
}
}
}
]
}
|
This blueprint:
Generates a post with this content:
It can be a useful addition for blueprints started using the CLI in this way:
TEST="test" bun cli.ts server --blueprint=./test.json
To inherit the
TEST
environment var. This is a quite advanced option so it should be available only toPHPRunOptions
. Theenv
record should be open to be overwritten by the caller. Such as:So that it will be possible to write this for rapid prototyping:
TEST="true" bun cli.ts server --blueprint=./test.json
The CLI should have a list of env vars to exclude, such as other security measures.
Addendum: Apparently,
$_ENV
does not have the values passed if used in thecode
entry. This may be a bug.The text was updated successfully, but these errors were encountered: