From 173ab188b326fbe78cfba4ab455a74619f4556bb Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Mon, 24 Jun 2024 09:39:18 +0100 Subject: feat(login): store in git config and use cache replace ngit yaml file config with: * nsec / ncryptsec / npub in git config in nostr.* namespace * sql database cache for metadata and relay events allow different logins to be used for different git repositories by storing login in local git config --- test_utils/src/lib.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'test_utils/src/lib.rs') diff --git a/test_utils/src/lib.rs b/test_utils/src/lib.rs index ff1f41b..bf6c37b 100644 --- a/test_utils/src/lib.rs +++ b/test_utils/src/lib.rs @@ -952,17 +952,20 @@ where } fn backup_existing_config() -> Result<()> { - let config_path = get_dirs().config_dir().join("config.json"); - let backup_config_path = get_dirs().config_dir().join("config-backup.json"); + let config_path = get_dirs().config_dir().join("cache.sqlite"); + let backup_config_path = get_dirs().config_dir().join("cache-backup.sqlite"); + if !backup_config_path.exists() { + std::fs::rename(&config_path, backup_config_path)?; + } if config_path.exists() { - std::fs::rename(config_path, backup_config_path)?; + std::fs::remove_file(&config_path)?; } Ok(()) } fn restore_config_backup() -> Result<()> { - let config_path = get_dirs().config_dir().join("config.json"); - let backup_config_path = get_dirs().config_dir().join("config-backup.json"); + let config_path = get_dirs().config_dir().join("cache.sqlite"); + let backup_config_path = get_dirs().config_dir().join("cache-backup.sqlite"); if config_path.exists() { std::fs::remove_file(&config_path)?; } -- cgit v1.2.3