Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add bitwardenSecrets template function #3194

Merged
merged 1 commit into from
Aug 27, 2023
Merged

feat: Add bitwardenSecrets template function #3194

merged 1 commit into from
Aug 27, 2023

Conversation

twpayne
Copy link
Owner

@twpayne twpayne commented Aug 26, 2023

Fixes #3193.

@fslef would you be able to test this?

@twpayne twpayne force-pushed the fix-3193 branch 2 times, most recently from 844723c to 32b35e7 Compare August 26, 2023 14:44
@fslef
Copy link

fslef commented Aug 26, 2023

Fixes #3193.

@fslef would you be able to test this?

I would be glad to help. What is the best way to proceed?
I'm running mac os and I've installed chezmoi using Homebrew

@twpayne
Copy link
Owner Author

twpayne commented Aug 26, 2023

The easiest way to proceed is to download the chezmoi binary built from this PR, which you can find here. I guess you'll want either the chezmoi-darwin-amd64 or chezmoi-darwin-arm64 depending on your architecture. Some unzipping might be needed.

You can then run this binary locally and use the chezmoi execute-template command to test the bitwardenSecrets template function, something like:

$ export BWS_ACCESS_TOKEN=my-access-token
$ ./chezmoi execute-template '{{ bitwardenSecrets "my-secret-id" | toJson }}'
$ ./chezmoi execute-template '{{ (bitwardenSecrets "my-secret-id").value }}'

Also, does the bitwardenSecrets template function seem reasonable? I made the access token overridable for the case where people want to get secrets from different projects.

Copy link
Collaborator

@halostatue halostatue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven’t tried this (no bitwarden account), but the code is solid.

The only thing that seems to be missing is "profile" support, but I don’t see an easy way to do that with support for the access token as a parameter, since Go (templates) has no concept of a "named" parameter. https://bitwarden.com/help/secrets-manager-cli/#config-profile

@fslef
Copy link

fslef commented Aug 27, 2023

Hello @twpayne, just confirming that it's working as expected.
Big thanks for the speedy implementation.

@twpayne twpayne merged commit f6947d3 into master Aug 27, 2023
20 checks passed
@twpayne twpayne deleted the fix-3193 branch August 27, 2023 21:03
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integration of Bitwarden Secrets CLI into chezmoi
3 participants