1
0
mirror of https://github.com/getsops/sops.git synced 2026-02-05 12:45:21 +01:00
Files
sops/examples/all_in_one/bin/decrypt-config.sh
2016-02-24 22:02:22 -06:00

23 lines
609 B
Bash
Executable File

#!/usr/bin/env bash
# Exit on first error
set -e
# Define our secret files
secret_files="secret.enc.json"
# For each of our files in our encrypted config
for file in $secret_files; do
# Determine src and target for our file
src_file="config/$file"
target_file="$(echo "config/$file" | sed -E "s/.enc.json/.json/")"
# If we only want to copy, then perform a copy
# DEV: We allow `CONFIG_COPY_ONLY` to handle tests in Travis CI
if test "$CONFIG_COPY_ONLY" = "TRUE"; then
cp "$src_file" "$target_file"
# Otherwise, decrypt it
else
sops --decrypt "$src_file" > "$target_file"
fi
done