|
|
|
|
@ -124,7 +124,7 @@ function main(){
|
|
|
|
|
# assume location of script as running directly from repo with keys (instead of as a standalone packaged tool)
|
|
|
|
|
keyfiles_dir="${repo_root}"
|
|
|
|
|
# assume location of secrets config file in pwd
|
|
|
|
|
sops_config_dir="${PWD}"
|
|
|
|
|
sops_config_dir=""
|
|
|
|
|
# path to group definitions
|
|
|
|
|
groups_def_dir="${repo_root}/groups"
|
|
|
|
|
# optional:
|
|
|
|
|
@ -168,9 +168,15 @@ function main(){
|
|
|
|
|
# VALIDATE INPUTS
|
|
|
|
|
keyfiles_dir="$(realpath "${keyfiles_dir}")"
|
|
|
|
|
test -d "${keyfiles_dir}" || (echo "E: specify dir containing keyfiles; invalid dir: '${keyfiles_dir}'" && exit 1)
|
|
|
|
|
sops_config_dir="$(realpath "${sops_config_dir}")"
|
|
|
|
|
test -d "${sops_config_dir}" || (echo "E: specify dir containing .sops.yaml, invalid dir: '${sops_config_dir}'" && exit 1)
|
|
|
|
|
sops_config="${sops_config_dir}/.sops.yaml"
|
|
|
|
|
sops_config=""
|
|
|
|
|
if [[ -n "${sops_cfg_dir:-}" ]]; then
|
|
|
|
|
sops_config_dir="$(realpath "${sops_config_dir}")"
|
|
|
|
|
test -d "${sops_config_dir}" || (echo "E: specify dir containing .sops.yaml, invalid dir: '${sops_config_dir}'" && exit 1)
|
|
|
|
|
sops_config="${sops_config_dir}/.sops.yaml"
|
|
|
|
|
set -x
|
|
|
|
|
touch "${sops_config}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# locate appropriate sops config if default assumption not found
|
|
|
|
|
if [[ ! -e "${sops_config}" ]]; then
|
|
|
|
|
# dev note: '2> /dev/null' to disable debug output
|
|
|
|
|
|