Merge pull request #204560 from jcumming/resilio_config_passthru

passthrough config if there are no secrets defined (address #204559)
This commit is contained in:
K900 2022-12-11 17:50:37 +03:00 committed by GitHub
commit a95574fd2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,17 +52,22 @@ let
runConfigPath = "/run/rslsync/config.json";
createConfig = pkgs.writeShellScriptBin "create-resilio-config" ''
${pkgs.jq}/bin/jq \
'.shared_folders |= map(.secret = $ARGS.named[.dir])' \
${
lib.concatMapStringsSep " \\\n "
(entry: ''--arg '${entry.dir}' "$(cat '${entry.secretFile}')"'')
sharedFoldersSecretFiles
} \
<${configFile} \
>${runConfigPath}
'';
createConfig = pkgs.writeShellScriptBin "create-resilio-config" (
if cfg.sharedFolders != [ ] then ''
${pkgs.jq}/bin/jq \
'.shared_folders |= map(.secret = $ARGS.named[.dir])' \
${
lib.concatMapStringsSep " \\\n "
(entry: ''--arg '${entry.dir}' "$(cat '${entry.secretFile}')"'')
sharedFoldersSecretFiles
} \
<${configFile} \
>${runConfigPath}
'' else ''
# no secrets, passing through config
cp ${configFile} ${runConfigPath};
''
);
in
{