refactor(scripts): convert scripts/encrypt-secret to Python

This commit is contained in:
Harsh Shandilya 2023-08-03 12:21:43 +05:30
parent 1e0cc062d5
commit 69f63cced4
No known key found for this signature in database
2 changed files with 31 additions and 18 deletions

View file

@ -1,18 +0,0 @@
#!/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