envchain
envchain copied to clipboard
Passing multiline values into `--set`
Background
I want to use envchain
within our mobile team to store the App Store Connect API key credentials, which consist of an issuer id, key id and .p8 key file.
For simplicity and security, we already hold the .p8 file contents in secrets on Bitrise and since we need to run some operations locally, it feels like it would be appropriate to do this as well using envchain
.
Problem
The problem that I faced however was that I couldn't get the multiline string to work with envchain --set
.
If i try pasting it, only the first line is accepted. I also tried something like the following:
$ cat /path/to/key.p8 | envchain --set asc APP_STORE_CONNECT_API_KEY_KEY
But the same issue, only the first line is written.
Workaround
I can open the Keychain Access app and paste the multiline string in there, but it would be great if this could be avoided.
I'm sorry that I can't open a Pull Request directly for this, I am not very good with C 😄
I can open the Keychain Access app and paste the multiline string in there, but it would be great if this could be avoided.
Yes this is a current restriction and valid workaround to deal with multiline strings...
Thanks for confirming @sorah! In the end I was able to use the security
command directly to automate it a bit better:
$ security add-generic-password -c appl -D envchain -s envchain-asc -a APP_STORE_CONNECT_API_KEY_KEY -w "$(cat /path/to/AuthKey_FFFFFFFFFFF.p8)"