{"repo":"sparanoid/env.sh","free":true,"listed":false,"github":"https://github.com/sparanoid/env.sh","clone":"git clone https://github.com/sparanoid/env.sh.git","description":"Dead-simple .env file reader and generator","language":"Shell","stars":27,"topics":["bash","docker","nextjs","reactjs","create-next-app"],"license":"Apache-2.0","category":"deployment-docker-iac","readme_excerpt":"env.sh Dead-simple .env file reader and generator Features - Designed to be used for Next.js app inside a Docker container (General React app should also work) - Read env file and generate env.js file for runtime client use - Merge current environment variables passing to it (Useful for Docker images) - No dependencies (More like a lite version of react-env). But does not require you to build your project inside the container. The benefit of this method can help you avoid multistage Dockerfile. You can build your Next.js project in GitHub Actions. And only COPY built files required for production. With this method your image can be much smaller. Usage Simply copy env.sh to the root of your project. And follow the steps. General usage: Replacing varaible: Enviroment variable not in whitelist will be discarded: Change script options: Use it with your existing project. Modify your scripts in package.json : Create a utils.js to use it in runtime client: In document.js : In MyComponent.js : Now you can run yarn dev and see API BASE dynamically injected to your app for client-side rendering. Use it inside Dockerfile : Install bash for your image first (Here operator used in this script does not work with sh at the moment. This can be improved in the furture): Options ENVSH ENV Specify env file to read. Default: ./.env ENVSH PREFIX Only environment variables with this prefix will be matched. Default: NEXT PUBLIC ENVSH PREFIX STRIP If set to true , ENVSH PREFIX will be stripped from ","default_branch":null,"files":null,"tree":[],"storefront":"/r/sparanoid","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sparanoid/env.sh/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}