Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Last active October 11, 2024 19:04
Show Gist options
  • Select an option

  • Save wilmoore/ba193dcaeeac7732c1d09a0e7be2e8f6 to your computer and use it in GitHub Desktop.

Select an option

Save wilmoore/ba193dcaeeac7732c1d09a0e7be2e8f6 to your computer and use it in GitHub Desktop.
Personal Brand :: Social Media :: LinkedIn :: Post :: Loading .env files in bash scripts

Personal Brand :: Social Media :: LinkedIn :: Post :: Loading .env files in bash scripts

⪼ Made with 💜 by Polyglot.

related
» Loading .env files in bash scripts «

Sometimes, it’s necessary to create a bash script that shares some of the same environment variables as it's associated Node.js application. 

Below is how to handle loading the .env file when running a bash script assuming there is a .env file in the current working directory which includes a value for `API_KEY`.

Țechśavvy CEO

image

Best Practices for Safeguarding Secrets in Node.js Applications is an article I've recently written on my medium blog which goes in-depth on loading .env files in Node.js.

https://wilmoore.medium.com/best-practices-for-safeguarding-secrets-in-node-js-applications-b418aac49c9f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment