The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Export Passwords To Envionrmental Variables From Mac's Built-In Password Manger

TODO: Pull subtitle into page object
Code
export VAR_NAME=$(security find-generic-password -w -l keychain-password-name)

Put that in a file and whenever you need the specific password in an ENV var, run the file with:

Code
source FILENAME

You can then access the password like:

Code
echo $VAR_NAME

Or use it in apps like:

Code
process.env.VAR_NAME

Notes

Notes

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Export Passwords To Envionrmental Variables From Mac's 
Built-In Password Manger

Passwords and credentails stored in Mac's Keychain Access password
manager can be accessed from the command line with the `security``
command. I use that feature to store ENV vars in the app
then export them for use in apps. The code looks like this:

-- code
-- shell

export VAR_NAME=$(security find-generic-password -w -l keychain-password-name)

-- p

Put that in a file and whenever you need the 
specific password in an ENV var, run the file with:

-- code
-- shell

source FILENAME

-- p

You can then access the password like:

-- code
-- shell

echo $VAR_NAME

-- p

Or use it in apps like:

-- code
-- js

process.env.VAR_NAME


-- notes 

- Verify the `process.env.VAR_NAME`` is the correct syntax

- Add examples for other languages


-- notes

- You'll be asked to enter your password the first time you the
command. Click "Always Allow" if you don't want to have to do 
it again. Or, "Allow" if you want to have to type it in every time. 

- (Using `./FILENAME`` instead of `source FILENAME`` doesn't
work consistently when you run other processes)

- Some examples of using `security find-generic-password`` show
that you need the account name. I haven't needed that which I 
suspect is because I'm already on the same account. Not sure
about why, just that it works.

-- categories
-- Command Line
  

-- metadata
-- date: 2022-10-21 16:47:43
-- id: 2gsc8azc
-- site: aws
-- status: draft
-- type: post