Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions .chezmoi.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,35 @@
{{- end -}}

{{- $businessUse := env "BUSINESS_USE" | not | not -}}
{{- $hasOp := lookPath "op" | not | not -}}

{{- $name := promptStringOnce . "name" "Your name" -}}
{{- $email := promptStringOnce . "email" "Your email (personal)" -}}
{{- $name := "" -}}
{{- $email := "" -}}
{{- $workEmail := "" -}}
{{- if $businessUse -}}
{{- $workEmail = promptStringOnce . "work_email" "Your work email" -}}
{{- $npmToken := "" -}}

{{- if and (not $businessUse) $hasOp -}}
{{- $name = onepasswordRead "op://Dotfiles/Git/name" -}}
{{- $email = onepasswordRead "op://Dotfiles/Git/email" -}}
{{- $npmToken = onepasswordRead "op://Dotfiles/NPM/credential" -}}
{{- else -}}
{{- $name = promptStringOnce . "name" "Your name" -}}
{{- $email = promptStringOnce . "email" "Your email (personal)" -}}
{{- if $businessUse -}}
{{- $workEmail = promptStringOnce . "work_email" "Your work email" -}}
{{- end -}}
{{- end -}}

data:
osid: {{ $osID | quote }}
business_use: {{ $businessUse }}
has_op: {{ $hasOp }}

# User info (prompted on first run)
# User info (prompted on first run, or read from 1Password)
name: {{ $name | quote }}
email: {{ $email | quote }}
work_email: {{ $workEmail | quote }}
npm_token: {{ $npmToken | quote }}

# Auto tmux on terminal startup
auto_tmux: true
Expand Down
2 changes: 1 addition & 1 deletion .chezmoiscripts/run_once_setup-gh-auth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ if gh auth status &>/dev/null; then
fi

echo "Setting up gh authentication via 1Password..."
op read "op://GH Token/token" | gh auth login --with-token
op read "op://Dotfiles/GH Token/token" | gh auth login --with-token

echo "gh authentication complete"
6 changes: 4 additions & 2 deletions dot_claude/settings.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"Bash(psql:*)",
"Bash(mysql:*)",
"Bash(mongod:*)",
"Read(.env.*)",
"Read(**/.env)",
"Read(**/.env.*)",
"Read(**/.dev.vars)",
"Read(id_rsa)",
"Read(id_ed25519)",
"Read(**/*token*)",
Expand All @@ -38,7 +40,7 @@
"Read(**/*secret*)",
"Read(**/.netrc)",
"Read(**/.npmrc)",
"Write(.env*)",
"Write(**/.env*)",
"Write(**/secrets/**)",
"Write(**/.ssh/*)",
"Write(**/authorized_keys)",
Expand Down
7 changes: 5 additions & 2 deletions dot_npmrc.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ color=always
engine-strict=true
save-exact=true

# Auth (token from environment variable)
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
{{- if ne .npm_token "" }}

# Auth (from 1Password)
//registry.npmjs.org/:_authToken={{ .npm_token }}
{{- end }}

Loading