You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
900 B
Bash
20 lines
900 B
Bash
#!/usr/bin/env bash
|
|
set -ueo pipefail
|
|
|
|
keys_dir="$(dirname "${BASH_SOURCE[0]}")/.."
|
|
# deliberate just "dot" for current dir
|
|
sops_cfg_dir=.
|
|
secrets_file="mock_secrets.yaml"
|
|
|
|
# prerequisite: for verification of sops config, idempotent create file with a mock secret, src: https://bash-org-archive.com/?244321
|
|
test -e "${secrets_file}" || (yq -n '.demo.credentials.secret = "hunter2"' > "${secrets_file}" && sops -e -i "${secrets_file}" )
|
|
|
|
set -x
|
|
# SAMPLE COMMANDS - manually uncomment to try out
|
|
# minimal operation: update .sops.yaml, update keys in encrypted file
|
|
../bin/update_sops.sh "${secrets_file}"
|
|
# Full Args: specify path to each, also for secrets, mix specified and positional params
|
|
# ../bin/update_sops.sh -k "${keys_dir}" -c "${sops_cfg_dir}" -s "${secrets_file}" "${secrets_file}"
|
|
# TEST: induce error: invalid file
|
|
# ../bin/update_sops.sh "${secrets_file}" -s non_existing_secrets.yaml
|