1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-02 16:09:46 +01:00

move curl shell function into string variable

Allows us to reuse the function in different scripts.
This commit is contained in:
Peter Kling 2024-08-29 20:36:07 +02:00
parent 3d034b9906
commit 295a580ca7

View file

@ -66,12 +66,7 @@ let
''}
'';
updateConfig = pkgs.writers.writeBash "merge-syncthing-config" (''
set -efu
# be careful not to leak secrets in the filesystem or in process listings
umask 0077
curlShellFunction = ''
curl() {
# get the api key by parsing the config.xml
while
@ -85,6 +80,15 @@ let
--retry 1000 --retry-delay 1 --retry-all-errors \
"$@"
}
'';
updateConfig = pkgs.writers.writeBash "merge-syncthing-config" (''
set -efu
# be careful not to leak secrets in the filesystem or in process listings
umask 0077
${curlShellFunction}
'' +
/* Syncthing's rest API for the folders and devices is almost identical.