]> gitweb.fluxo.info Git - keyringer.git/commitdiff
Feat: init: allow for non-interactive mode, useful for automated tests (#10)
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 4 Jan 2025 20:24:15 +0000 (17:24 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 4 Jan 2025 20:24:15 +0000 (17:24 -0300)
.gitlab-ci.yml
keyringer

index 496737827fe5c2ff8f817780d6a85cce70d8b07c..2881afb5ca1e6c73cfef8dc6ff9c54fb333cc80f 100644 (file)
@@ -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); gsub(/>/, "", x); print x, $8; }' >> ~/temp/tests/keyringer/config/recipients/default
     - ./keyringer test check
     - ./keyringer test teardown -y
index 938216b7d5e22bbf830608de8438fdbf027b39fe..75d704f33c407a02cc3bd56a085fa2b1e99dbf0c 100755 (executable)
--- 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 .