Load Environmental Variables Via Script Commands In cargo make
May 2024
I don't like storing credentails in plain-text. Aside from the possibilty of accidentally committing them to a repo I also stream. That opens up another way to dox myself.
Whenever possible (which is close to always), I store my credentails in a password manager and then pull them into my processes programatically. For example, I can create put a credentail in macOS's KeyChain Access app and then access it in a cargo make1 Makefile.toml with:
[env]
MY_PASSWORD = { script = ["security find-generic-password -w -a alan -s some-password-name"] }
SOME_CREDENTAIL = { script = ["cat /Users/username/.ssh/Credentails.txt | xargs"]Notes
-
That makes
$MY_PASSWORDavailable in all the[tasks.task_name]tasks during the run. -
The pass to
xargsin thecatexample is to remove trailing whitespace from the Crednetials.txt file which is part of Apples process of signing and notarizing Tauri apps for macs. Without thexargsI was getting:
Info setup keychain from environment variables...
Error failed to bundle project: failed to import keychain certificateend of line