How to fetch env variables in style.js/tileset.js
polastre opened this issue · 2 comments
polastre commented
Is there a way to use process.env
in those files or in a config.js
that is loaded in?
I get the error:
java.io.IOException: org.graalvm.polyglot.PolyglotException: ReferenceError: process is not defined
which seems to be an artifact of using Polyglot.
Any suggestions?
bchapuis commented
The environment variables were not yet exposed to the javascript execution context. After merging #776, you should be able to access them as follow:
env["VARIABLE_NAME"];
The following should print all the variables:
console.log(JSON.stringify(env, null, 2));
polastre commented
This would be fantastic.