Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Created October 5, 2024 21:42
Show Gist options
  • Select an option

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

Select an option

Save wilmoore/2b4b1e5e4bd08ed7f6b440ea2b9a79df to your computer and use it in GitHub Desktop.
Personal Brand :: Social Media :: LinkedIn :: Post :: Creating .env files for development

Personal Brand :: Social Media :: LinkedIn :: Post :: [Creating .env files for development]

⪼ Made with 💜 by Polyglot.

related

[Creating .env files for development]

» How I create .env files for development «

  ❯ cat > .env <<EOF                                                                                                                                                                             [2024-10-05 14:37:12]
  GIST_API_KEY='$(security find-generic-password -s GIST_API_KEY -w)'
  EOF

  ❯ cat .env                                                                                                                                                                                     [2024-10-05 14:40:28]
  GIST_API_KEY='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'

  ❯ node --env-file=.env                                                                                                                                                                         [2024-10-05 14:40:55]
  Welcome to Node.js v22.2.0.
  Type ".help" for more information.
  > process.env.GIST_API_KEY
  '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'


> async function request() {
...   return fetch('https://api.github.com/gists?per_page=100&page=1', {
...     method: 'GET',
...     headers: {
...       'Accept': 'application/vnd.github+json',
...       'Authorization': `Bearer ${process.env.GIST_API_KEY}`,
...       'X-GitHub-Api-Version': '2022-11-28'
...     }
...   })
...   .then(response => response.json())
...   .then(data => data && data.length && data[0].description ? data[0].description : '');
... }
undefined
> await request()
'Personal Brand :: Social Media :: LinkedIn :: Post :: Intention Revealing Code'
>


Țechśavvy CEO

[Comment]


[Creating .env files for development]:

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