From a872a8099e10071063c5c9615c9421a6243aa901 Mon Sep 17 00:00:00 2001 From: Eric Renfro Date: Wed, 27 Dec 2023 17:20:01 -0500 Subject: [PATCH] Added first use of rbw to extract ssh key for gitconfig --- .chezmoi.toml.tmpl | 16 ++++++++++++++-- dot_gitconfig => dot_gitconfig.tmpl | 7 ++++--- 2 files changed, 18 insertions(+), 5 deletions(-) rename dot_gitconfig => dot_gitconfig.tmpl (91%) diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl index f2de2bc..de3916e 100644 --- a/.chezmoi.toml.tmpl +++ b/.chezmoi.toml.tmpl @@ -5,9 +5,17 @@ {{ $email := "psi-jack@linux-help.org" -}} {{ $work := false -}} +{{ $ssh := "" -}} {{ if ne $personal true -}} -{{ $email := promptStringOnce . "email" "What is your email" -}} -{{ $work := promptBoolOnce . "work" "Is this for work" -}} +{{ $email = promptStringOnce . "email" "What is your email" -}} +{{ $work = promptBoolOnce . "work" "Is this for work" -}} +{{ if eq $work true -}} +{{ $ssh = (rbwFields "ssh-key-work").publickey.value -}} +{{ else -}} +{{ $ssh = (rbwFields "ssh-key").publickey.value -}} +{{ end -}} +{{ else -}} +{{ $ssh = (rbwFields "ssh-key").publickey.value -}} {{ end -}} {{ $osid := .chezmoi.os -}} @@ -17,9 +25,13 @@ {{ end -}} {{ end -}} + +encryption = "age" + [data] name = "Eric Renfro" email = {{ $email | quote }} + ssh = {{ $ssh | quote }} osid = {{ $osid | quote }} personal = {{ $personal }} diff --git a/dot_gitconfig b/dot_gitconfig.tmpl similarity index 91% rename from dot_gitconfig rename to dot_gitconfig.tmpl index 62a62c0..161575a 100644 --- a/dot_gitconfig +++ b/dot_gitconfig.tmpl @@ -1,8 +1,9 @@ [user] - name = Eric Renfro - email = psi-jack@linux-help.org + name = {{ .name }} + email = {{ .email }} #signingkey = 25787986B19167B89BFF55CF3159FF4CB13EBFB4 - signingkey = ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILOOehoX8okqwKyFj4ozRODK0tIb3aeHlYC9re1/3IbC Eric Renfro (Home/ed25519) + #signingkey = ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILOOehoX8okqwKyFj4ozRODK0tIb3aeHlYC9re1/3IbC Eric Renfro (Home/ed25519) + signingkey = {{ .ssh }} [gpg] #program = gpg2 format = ssh