DEV Community

Discussion on: How to structure your Express and Node.Js project

Collapse
 
nermineslimane profile image
nermineslimane • Edited

Find out all about .env in this article dev.to/nermineslimane/what-is-env-..., concerning the fact that it should never be pushed to version control it's purely and solely for security reasons since it holds info about the secret keys of your app that shouldn't be shared so for that purpose every deployement way has it's specific way to add the .env file , in your case what are you using to deploy the application ?

Collapse
 
adhirkirtikar profile image
Adhir Kirtikar

Thanks for the reply and link.
I used docker to containerize the node.js express app and used GitHub action to add the .env file in the container. I googled this method when I was doing the DEV project. But I think that if someone gets the docker image then they can easily find out the .env file. :D
So I wanted to know what’s the industry standard used to deploy this .env file.

docker-build.yml:

        name: Make envfile
        uses: SpicyPizza/create-envfile@v1
        with:
          envkey_DB_USER: ${{ secrets.DB_USER }}
          envkey_DB_PASS: ${{ secrets.DB_PASS }}
          envkey_DB_NAME: ${{ secrets.DB_NAME }}
          directory: /home/runner/work/IMDb-MongoDb/IMDb-MongoDb
          file_name: .env    ```

Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
nermineslimane profile image
nermineslimane

Looking for the answear for you will you allow to post the subject on a forum ? maybe we'll both find the stardard for this ?

Thread Thread
 
adhirkirtikar profile image
Adhir Kirtikar

Yes of course. πŸ‘πŸΌ

Thread Thread
 
nermineslimane profile image
nermineslimane

wel thank you and here's the link to the stackexchange post if anyone wants to contribute feel free softwareengineering.stackexchange....