From 162944bc4919579dfae34a59b9c04a86f3509316 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 4 Jan 2025 17:24:15 -0300 Subject: Feat: init: allow for non-interactive mode, useful for automated tests (#10) --- .gitlab-ci.yml | 2 +- keyringer | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4967378..2881afb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -73,7 +73,7 @@ test: - mkdir -p ~/temp/tests - git config --global user.name 'Test' - git config --global user.email 'test@example.org' - - ./keyringer test init ~/temp/tests/keyringer + - KEYRINGER_NON_INTERACTIVE=1 ./keyringer test init ~/temp/tests/keyringer - gpg --with-colons --list-keys | grep uid | awk -F ':' '{ x = $10; gsub(/.*/, "", x); print x, $8; }' >> ~/temp/tests/keyringer/config/recipients/default - ./keyringer test check - ./keyringer test teardown -y diff --git a/keyringer b/keyringer index 938216b..75d704f 100755 --- a/keyringer +++ b/keyringer @@ -112,10 +112,12 @@ function keyringer_init { fi # Edit default recipients - echo "Now you have to edit the default recipient configuration to be able to encrypt secrets." - echo "Press any key to proceed editing..." - read key - keyringer_exec recipients "$BASEDIR" edit default + if [ "$KEYRINGER_NON_INTERACTIVE" != "1" ]; then + echo "Now you have to edit the default recipient configuration to be able to encrypt secrets." + echo "Press any key to proceed editing..." + read key + keyringer_exec recipients "$BASEDIR" edit default + fi # Stage and commit keyringer_exec git "$BASEDIR" add . -- cgit v1.2.3