⪼ Made with 💜 by Polyglot.
» 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
[Creating .env files for development]: