This repository was archived by the owner on Jul 3, 2020. It is now read-only.
This repository was archived by the owner on Jul 3, 2020. It is now read-only.
Environment Variables/Command Line Arguments #134
Open
Description
This was brought to my attention by @aafrey on Gitter.
This is already kind of possible by using kernel command line arguments (--append
and __SYSCALL.getCommandLine()
), but it's neither officially supported nor elegant.
Why?
- Well, servers need a way to use hidden variables, especially with open source server code
- Also, it allows to quickly change a value when starting up a VM, instead of digging in to the code
How to pass them in?
- Maybe another argument for
runtime-cli
- ...or maybe this could be another use for
runtime.json
Problems with each implementation:
- As an argument: there's no way to make it persistent (unless you script the running)
- As a property in
runtime.json
: if you.gitignore
it so that you don't accidentally leak the variables, you're also gitignoring a file that might contain settings you do want to commit (e.g. v8.flags)
Possible solution:
Implement both? That way, you can make unimportant variables persistent by adding them to runtime.json
, while keeping ultimately secret variables as arguments.
How to get them?
Well, process.env
!