Added encryption availability checks

This commit is contained in:
Brian Zalewski 2023-06-14 05:20:18 +00:00
parent 2e877ccffd
commit 551aae1f02
5 changed files with 6 additions and 6 deletions

View file

@ -149,7 +149,7 @@ GHORG_EXIT_CODE_ON_CLONE_ISSUES: 1
# Add your GitHub token
# flag (--token, -t) eg: --token=bGVhdmUgYSBjb21tZW50IG9uIGlzc3VlIDY2
GHORG_GITHUB_TOKEN: {{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "GITHUB_READ_TOKEN")) }}{{ includeTemplate "secrets/GITHUB_READ_TOKEN" | decrypt }}{{ else }}{{ env "GITHUB_READ_TOKEN" }}{{ end }}
GHORG_GITHUB_TOKEN: {{ if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "GITHUB_READ_TOKEN")) }}{{ includeTemplate "secrets/GITHUB_READ_TOKEN" | decrypt }}{{ else }}{{ env "GITHUB_READ_TOKEN" }}{{ end }}
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# |G|I|T|L|A|B| |S|P|E|C|I|F|I|C|
@ -157,7 +157,7 @@ GHORG_GITHUB_TOKEN: {{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates"
# Add your GitLab token
# flag (--token, -t) eg: --token=bGVhdmUgYSBjb21tZW50IG9uIGlzc3VlIDY2
GHORG_GITLAB_TOKEN: {{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "GITLAB_READ_TOKEN")) }}{{ includeTemplate "secrets/GITLAB_READ_TOKEN" | decrypt }}{{ else }}{{ env "GITLAB_READ_TOKEN" }}{{ end }}
GHORG_GITLAB_TOKEN: {{ if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "GITLAB_READ_TOKEN")) }}{{ includeTemplate "secrets/GITLAB_READ_TOKEN" | decrypt }}{{ else }}{{ env "GITLAB_READ_TOKEN" }}{{ end }}
# clones repos in a directory structure that matches gitlab namespaces eg company/unit/subunit/app would clone into ghorg/org/unit/subunit/app
# flag (--preserve-dir)

View file

@ -9,4 +9,4 @@ loglevel=error
network-concurrency=32
prefix={{ .chezmoi.homeDir }}/.local/share/npm
strict-peer-dependencies=false
//registry.npmjs.org/:_authToken={{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NPM_TOKEN")) }}{{- includeTemplate "secrets/NPM_TOKEN" | decrypt -}}{{ else if (env "NPM_TOKEN") }}{{- env "NPM_TOKEN" -}}{{ else }}${NPM_TOKEN}{{ end }}
//registry.npmjs.org/:_authToken={{ if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NPM_TOKEN")) }}{{- includeTemplate "secrets/NPM_TOKEN" | decrypt -}}{{ else if (env "NPM_TOKEN") }}{{- env "NPM_TOKEN" -}}{{ else }}${NPM_TOKEN}{{ end }}

View file

@ -343,7 +343,7 @@ export PATH="$VOLTA_HOME/bin:$PATH"
### Wakatime
export WAKATIME_HOME="$XDG_CONFIG_HOME/wakatime"
export WAKATIME_API_KEY="{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "WAKATIME_API_KEY")) }}{{ includeTemplate "secrets/VAGRANT_CLOUD_TOKEN" | decrypt }}{{ else }}{{ env "WAKATIME_API_KEY" }}{{ end }}"
export WAKATIME_API_KEY="{{ if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "WAKATIME_API_KEY")) }}{{ includeTemplate "secrets/VAGRANT_CLOUD_TOKEN" | decrypt }}{{ else }}{{ env "WAKATIME_API_KEY" }}{{ end }}"
### wget
export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc"

View file

@ -1,5 +1,5 @@
{
"slack_token": "{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "SLACK_API_TOKEN")) }}{{- includeTemplate "secrets/SLACK_API_TOKEN" | decrypt -}}{{ else }}{{- env "SLACK_API_TOKEN" -}}{{ end }}",
"slack_token": "{{ if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "SLACK_API_TOKEN")) }}{{- includeTemplate "secrets/SLACK_API_TOKEN" | decrypt -}}{{ else }}{{- env "SLACK_API_TOKEN" -}}{{ end }}",
"sidebar_width": 3,
"notify": "mention",
"emoji": true,

View file

@ -1,5 +1,5 @@
#!/usr/bin/env bash
echo "{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NPM_TOKEN")) }}{{ includeTemplate "secrets/NPM_TOKEN" | decrypt }}{{ else if (env "NPM_TOKEN") }}{{ env "NPM_TOKEN" }}{{ else }}${GITHUB_GIST_TOKEN}{{ end }}" > ~/.gist
echo "{{ if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NPM_TOKEN")) }}{{ includeTemplate "secrets/NPM_TOKEN" | decrypt }}{{ else if (env "NPM_TOKEN") }}{{ env "NPM_TOKEN" }}{{ else }}${GITHUB_GIST_TOKEN}{{ end }}" > ~/.gist
gist $*
rm -f ~/.gist