-
Is it possible to encrypt a .tmpl file or a template stored in .chezmoitemplates ? I'm not seeing a way to do this. What I'm trying to accomplish, perhaps there's a better way, is to encrypt part of a file and not the whole thing. The file itself is a .tmpl and has a dynamic include {{ template "file" }} that's based on the OS chezmoi is being installed on. It's just that secondary template that I want encrypted. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
The easy way to do this is to use the
Where $ chezmoi encrypt -o $(chezmoi source-path)/.encrypted-data.txt unencrypted-data.txt |
Beta Was this translation helpful? Give feedback.
-
Much appreciated, I have the basics working. But have a few follow up questions.
(P.S. This project is amazing and I thank you greatly for its creation! I've read your other post on the challenges of OSS and I humbly give you my deepest gratitude for all that you do here) |
Beta Was this translation helpful? Give feedback.
-
You know what.. I think your own config may have given me a better answer. https://github.com/twpayne/dotfiles/blob/master/home/private_dot_ssh/config.tmpl
This is basically what I was trying to achieve. But I've simplified a few different things, and now realizing I could just load this via 1P. I'll still refer to my questions above. As I may need to encrypt some other things in the future. The problem even with 1P is that I can't easily cz edit this stored config, right? |
Beta Was this translation helpful? Give feedback.
-
Thanks again, @twpayne! Chezmoi has been a life saver I've been looking for the last 25 years! |
Beta Was this translation helpful? Give feedback.
The easy way to do this is to use the
decrypt
template function, something like:Where
.encrypted-data.txt
is the file containing the encrypted data. The leading.
makes chezmoi ignore it. You can create it with:$ chezmoi encrypt -o $(chezmoi source-path)/.encrypted-data.txt unencrypted-data.txt