fix: pass in base64 for rclone
This commit is contained in:
parent
11ba6a8957
commit
1948433764
@ -26,19 +26,32 @@ def log_debug(msg):
|
||||
if DEBUG:
|
||||
print(f"🔍 DEBUG: {msg}", flush=True)
|
||||
|
||||
def obscure_password(password):
|
||||
result = subprocess.run(
|
||||
["rclone", "obscure", password],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=True
|
||||
)
|
||||
return result.stdout.strip()
|
||||
|
||||
def write_rclone_config():
|
||||
"""Write rclone config file dynamically"""
|
||||
"""Write secure rclone config file with obscured password"""
|
||||
config_dir = "/tmp/rclone"
|
||||
os.makedirs(config_dir, exist_ok=True)
|
||||
config_path = os.path.join(config_dir, "rclone.conf")
|
||||
|
||||
obscured_password = obscure_password(NEXTCLOUD_PASSWORD)
|
||||
|
||||
with open(config_path, "w") as f:
|
||||
f.write(f"""[nextcloud]
|
||||
type = webdav
|
||||
url = {NEXTCLOUD_URL_DAV}
|
||||
vendor = nextcloud
|
||||
user = {NEXTCLOUD_USER}
|
||||
pass = {NEXTCLOUD_PASSWORD}""")
|
||||
pass = {obscured_password}
|
||||
encoding = Slash,BackSlash,Colon,Dot
|
||||
""")
|
||||
|
||||
return config_path
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user