take config file via cmd line

This commit is contained in:
jaina heartles 2024-12-25 15:35:47 -05:00
parent 24094cad31
commit 9606a755d0

View file

@ -23,11 +23,12 @@ let
mktemp
];
excludeShellChecks = [ "SC1091" ];
text = ''
bucket="$(cat "${backupConfigFile}" | grep 'bucket=' | sed 's/bucket \?= \?')"
prefix="$(cat "${backupConfigFile}" | grep 'prefix=' | sed 's/prefix \?= \?')"
configFile="$1"
s3cfg="$2"
bucket="$(cat "$configFile" | grep 'bucket=' | sed 's/bucket \?= \?')"
prefix="$(cat "$configFile" | grep 'prefix=' | sed 's/prefix \?= \?')"
s3Dir="s3://$bucket/\$\{prefix}misskey-$(date --iso-8601)"
echo "Uploading backups to '$s3Dir'"
@ -35,7 +36,7 @@ let
function upload () {
name="$1"
s3cmd put --config "${s3Cfg}" - "$s3Dir/$name"
s3cmd put --config "$s3cfg" - "$s3Dir/$name"
}
echo "Uploading config"
@ -62,7 +63,7 @@ in {
enable = true;
systemCronJobs = [
# run every monday at ass in the morning, EST"
"0 8 0 0 1 ${user} ${backupScript}"
"0 8 0 0 1 ${user} ${backupScript} ${backupConfigFile} ${s3Cfg}"
];
};
}