diff --git a/home/dot_local/bin/post-installx/executable_post-docker-desktop.sh b/home/dot_local/bin/post-installx/executable_post-docker-desktop.sh index 70ee4d83..68d11692 100644 --- a/home/dot_local/bin/post-installx/executable_post-docker-desktop.sh +++ b/home/dot_local/bin/post-installx/executable_post-docker-desktop.sh @@ -15,7 +15,7 @@ if command -v docker > /dev/null; then logg info "Found DOCKERHUB_TOKEN in ${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/.chezmoitemplates/secrets" if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/age/chezmoi.txt" ]; then logg info 'Decrypting DOCKERHUB_TOKEN token with Age encryption key' - DOCKERHUB_TOKEN="$(cat "$CLOUDFLARED_CERT" | chezmoi decrypt)" + DOCKERHUB_TOKEN="$(cat "$DOCKERHUB_TOKEN_FILE" | chezmoi decrypt)" else logg warn 'Age encryption key is missing from ~/.config/age/chezmoi.txt' fi diff --git a/home/dot_local/bin/post-installx/executable_post-nginx.sh b/home/dot_local/bin/post-installx/executable_post-nginx.sh index 2fbad334..126d1559 100644 --- a/home/dot_local/bin/post-installx/executable_post-nginx.sh +++ b/home/dot_local/bin/post-installx/executable_post-nginx.sh @@ -19,11 +19,22 @@ if command -v nginx > /dev/null; then else ### Linux NGINX_CONFIG_DIR=/etc/nginx - logg info 'Downloading the NGINX Amplify installer script' - TMP="$(mktemp)" - curl -sSL https://github.com/nginxinc/nginx-amplify-agent/raw/master/packages/install.sh > "$TMP" - logg info 'Running the NGINX Amplify setup script' - API_KEY="{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NGINX_AMPLIFY_API_KEY")) }}{{- includeTemplate "secrets/NGINX_AMPLIFY_API_KEY" | decrypt | trim -}}{{ else }}{{- env "NGINX_AMPLIFY_API_KEY" -}}{{ end }}" sh "$TMP" + NGINX_AMPLIFY_API_KEY_FILE="${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/.chezmoitemplates/secrets/NGINX_AMPLIFY_API_KEY" + if [ -f "$NGINX_AMPLIFY_API_KEY_FILE" ]; then + logg info "Found NGINX_AMPLIFY_API_KEY in ${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/.chezmoitemplates/secrets" + if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/age/chezmoi.txt" ]; then + logg info 'Decrypting NGINX_AMPLIFY_API_KEY token with Age encryption key' + logg info 'Downloading the NGINX Amplify installer script' + TMP="$(mktemp)" + curl -sSL https://github.com/nginxinc/nginx-amplify-agent/raw/master/packages/install.sh > "$TMP" + logg info 'Running the NGINX Amplify setup script' + API_KEY="$(cat "$NGINX_AMPLIFY_API_KEY_FILE" | chezmoi decrypt)" sh "$TMP" + else + logg warn 'Age encryption key is missing from ~/.config/age/chezmoi.txt' + fi + else + logg warn "NGINX_AMPLIFY_API_KEY is missing from ${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/.chezmoitemplates/secrets" + fi fi logg info "Ensuring $NGINX_CONFIG_DIR is present" && sudo mkdir -p "$NGINX_CONFIG_DIR" logg info "Copying configuration files from $HOME/.local/etc/nginx to $NGINX_CONFIG_DIR"