scripts: return to monke

I don't like bash but turns out I dislike Python more

This reverts commit 2628bfc2cd, d77fa13903 and 69f63cced4.
This commit is contained in:
Harsh Shandilya 2023-08-10 02:58:08 +05:30
parent 892d68581d
commit 591c68a6e4
No known key found for this signature in database
8 changed files with 90 additions and 218 deletions

18
scripts/encrypt-secret.sh Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
INPUT_FILE="${1:-}"
OUTPUT_FILE="${2:-}"
AGE_KEY="${3:-}"
if ! command -v age 1>/dev/null; then
echo "age not installed"
exit 1
fi
if [[ -n "$AGE_KEY" && -n "$INPUT_FILE" && -n "$OUTPUT_FILE" ]]; then
age --encrypt -r "$(echo "${AGE_KEY}" | age-keygen -y)" -o "${OUTPUT_FILE}" < "${INPUT_FILE}"
else
echo "Usage: ./encrypt-secret.sh <input file> <output file> <encryption key>"
fi