From 6fbc195efd4a343a7e60314d5c34461ab84186fc Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sat, 14 Aug 2021 15:33:44 +0300
Subject: [PATCH] Improve rclone handling.

Automate the password handling once the password database is downloaded.
---
 .bashrc                            | 4 ++++
 .config/rclone/rclone.conf         | 2 +-
 Documents/bin/download-password-db | 6 +++++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/.bashrc b/.bashrc
index 9a77094..2b93652 100644
--- a/.bashrc
+++ b/.bashrc
@@ -231,6 +231,10 @@ prune_ssh_sockets () {
         -execdir sh -c 'lsof -t "$1" >/dev/null || rm "$1"' _ {} \;
 }
 
+rcnc () {
+    RCLONE_CONFIG_NEXTCLOUD_PASS="$(rclone obscure "$(ph show --field 'Password' 'shore.co.il/LDAP')")" rclone "$@"
+}
+
 set_title () {
     local default_title
     default_title="$(basename "$PWD")"
diff --git a/.config/rclone/rclone.conf b/.config/rclone/rclone.conf
index ce52714..53dbfdd 100644
--- a/.config/rclone/rclone.conf
+++ b/.config/rclone/rclone.conf
@@ -2,4 +2,4 @@
 type = webdav
 url = https://nextcloud.shore.co.il/remote.php/webdav/
 vendor = nextcloud
-
+user = nimrod
diff --git a/Documents/bin/download-password-db b/Documents/bin/download-password-db
index 375e80d..e48568c 100755
--- a/Documents/bin/download-password-db
+++ b/Documents/bin/download-password-db
@@ -2,7 +2,11 @@
 # pylint: disable=invalid-name
 
 """Runs rclone securely to download the Keepass password database from
-Nextcloud."""
+Nextcloud.
+
+This is meant as a bootstrap step to get the Keepass password database
+so that other steps that depend on the database can be used.
+"""
 
 import getpass
 import os
-- 
GitLab