Question, for local environments we want to set a ...
# box-products
d
Question, for local environments we want to set a javahome in server.json. However, in other environments we don't want/need to set it at all. I can't set it to blank so how can I get around this without using something like .env in non local environments.
b
@dfgrumpy I'd not put anything in the
server.json
and then in your local
.env
file ONLY put
Copy code
box_server_jvm_javaHome=/path/to/it
Then you'll only get that override locally, but you can use the same
server.json
in higher environments without it
That is using the feature of CommandBox that allows anything in your
server.json
to be overridden by convention with env vars https://commandbox.ortusbooks.com/embedded-server/configuring-your-server/env-var-overrides
And for what it's worth, you mentioned
I can't set it to blank
but I'm not sure what you mean as overriding that setting to be blank should actually cause it to not be used. So even though I still recommend what I mentioned above, it would also be possible for you to • hard-code a
jvm.javaHome
path in your
server.json
• Override it by setting
box_server_jvm_javaHome
to an empty string everywhere else
Or, for that matter, putting
Copy code
"javaHome" : "${MY_JAVA_HOME_PATH}"
in the
server.json
and then having
Copy code
MY_JAVA_HOME_PATH=/path/to/it=/path/to/it
defined only in your local
.env
file and on all other environments where it was undefined, it would just resolve to an empty string and be ignored
There's at least 3 ways to skin the cat šŸ™‚
d
Thanks for all that. I appreciate it.
šŸ‘ 1