autodesk-platform-services / aps-iot-extensions-demo

APS DataViz Extensions Demo:Visualizing IoT sensor data.
https://aps-iot-extensions-demo.autodesk.io
MIT License
10 stars 5 forks source link

Use dotenv to access env variables #8

Closed salahelfarissi closed 1 year ago

salahelfarissi commented 1 year ago

This PR aims to use dotenv to import env variables.

petrbroz commented 1 year ago

Thank you @salahelfarissi. Happy to merge this one.

Btw. I'm curious - what are the main advantages of dotenv? I mean, the way I usually set env. variables is, for example:

salahelfarissi commented 1 year ago

Hi @petrbroz. Recently I was working on integrating APS API into a React App (A monitoring plateform). We have seperate packages: api, front, ansible each having its own .env.example file.

This practice allows for better versionning, if I added a component related to APS API, I'll add its corresponding env variables along others that already exist (corresponding to db connection, AWS...) to the .env.example file, hence future developpement will concur these new env variables (developpers will be aware of their existence).

With this practice, and with the use of dotenv, to start developping you only need to:

petrbroz commented 1 year ago

Got it, thank you @salahelfarissi! Sounds like I should consider using dotenv in my other samples as well :)