about summary refs log tree commit diff
path: root/nixos/tests/syncthing-many-devices.nix
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2023-10-15 01:58:02 +0300
committerDoron Behar <doron.behar@gmail.com>2023-10-15 02:04:52 +0300
commit79c78d68c6b404df5ac3917911371916b924b014 (patch)
tree19af303cfa32630a1114047a8dc16e800203bf07 /nixos/tests/syncthing-many-devices.nix
parentb9b120c6071ee89b8ec28ab94f17fb3a797331a7 (diff)
nixos/syncthing: get API key for every curl request
Fixes #260262.
Diffstat (limited to 'nixos/tests/syncthing-many-devices.nix')
-rw-r--r--nixos/tests/syncthing-many-devices.nix18
1 files changed, 9 insertions, 9 deletions
diff --git a/nixos/tests/syncthing-many-devices.nix b/nixos/tests/syncthing-many-devices.nix
index dd8c8807725e9..2251bf0774533 100644
--- a/nixos/tests/syncthing-many-devices.nix
+++ b/nixos/tests/syncthing-many-devices.nix
@@ -117,17 +117,17 @@ let
 
     export RUNTIME_DIRECTORY=/tmp
 
-    # get the api key by parsing the config.xml
-    while
-        ! ${pkgs.libxml2}/bin/xmllint \
-            --xpath 'string(configuration/gui/apikey)' \
-            ${configPath} \
-            >"$RUNTIME_DIRECTORY/api_key"
-    do sleep 1; done
+    curl() {
+        # get the api key by parsing the config.xml
+        while
+            ! ${pkgs.libxml2}/bin/xmllint \
+                --xpath 'string(configuration/gui/apikey)' \
+                ${configPath} \
+                >"$RUNTIME_DIRECTORY/api_key"
+        do sleep 1; done
 
-    (printf "X-API-Key: "; cat "$RUNTIME_DIRECTORY/api_key") >"$RUNTIME_DIRECTORY/headers"
+        (printf "X-API-Key: "; cat "$RUNTIME_DIRECTORY/api_key") >"$RUNTIME_DIRECTORY/headers"
 
-    curl() {
         ${pkgs.curl}/bin/curl -sSLk -H "@$RUNTIME_DIRECTORY/headers" \
             --retry 1000 --retry-delay 1 --retry-all-errors \
             "$@"