adds function to locate sops config

ADP-216_sops_automation
LeeW 10 months ago
parent f4b465a151
commit 2662a25977

@ -95,21 +95,21 @@ function fn_sops_locate_config_in_git_repo(){
# starting dir, default: PWD. Note: 'realpath' to normalise the dir # starting dir, default: PWD. Note: 'realpath' to normalise the dir
start_dir="$(realpath "${1:-"${PWD}"}")"; start_dir="$(realpath "${1:-"${PWD}"}")";
stop_dir="$(git rev-parse --show-toplevel)" stop_dir="$(git rev-parse --show-toplevel)"
>&2 echo "# ---"
>&2 echo "# start_dir: "${start_dir}""
>&2 echo "# stop_dir: "${stop_dir}""
# sops_filepath="" # BEGIN
# being
search_dir="${start_dir}" search_dir="${start_dir}"
# stopping condition contender="${search_dir}/.sops.yaml"
# while [[ "${search_dir}" != "${stop_dir}" ]]; do # base case - located the file OR stopping condition - at top of repo
contender="${search_dir}/.sops.yaml" if [[ -e "${contender}" ]] || [[ "${search_dir}" == "${stop_dir}" ]]; then
if [[ -e "${contender}" ]]; then >&2 echo "# BASE CASE"
>&2 echo "# BASE CASE" echo "${contender}"
echo "${contender}" else
else >&2 echo "# walk up one dir..."
# walk up one dir fn_sops_locate_config_in_git_repo "$(dirname "${search_dir}")"
>&2 echo "# walk up one dir" fi
fn_sops_locate_config_in_git_repo "$(dirname "${search_dir}")"
fi
} }
function fn_sops_generate_config(){ function fn_sops_generate_config(){

Loading…
Cancel
Save