Skip to main content
Participant
March 25, 2022
Question

JavasScript plugin help - environment variables

  • March 25, 2022
  • 1 reply
  • 297 views

How do you read environment vars? Was hoping it was as simple as process.env.ENV_VAR, but that does not work.

 

Also, when using project.save, and isBusy() is true, what is the best way to wait until Substance is not busy and then save? I am basically creating a project and then saving it. For now I am using a setTimeout to 5 seconds which does the job, but maybe I can temporarily listen for the busyStatusChanged event when isBusy is true?

 

thanks!!

This topic has been closed for replies.

1 reply

Léna Piquet Froyok
Adobe Employee
Adobe Employee
March 30, 2022

With the Javascript API we don't provide a way to access the environement, so retireving the env-var of the process in which the application runs it not doable.

(You can however access that information via the Python API with the regular os module.)

 

Regarding saving in case the project is busy, a Timer is probably the best indeed. That's how the autosave plugin works if I recall properly. You can take a look at it for inspiration.

bens87174006
Participant
March 30, 2022

Thank you very much for confirming. This will be a good reason for us to move to python to match the rest the of the pipeline.