diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-06-24 09:39:18 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-06-24 09:39:18 +0100 |
| commit | 173ab188b326fbe78cfba4ab455a74619f4556bb (patch) | |
| tree | 743a2413c241f7babd4efb336718c510eb743847 /test_utils/src | |
| parent | 681fdd7683363c62251ecd8dabcc1931a18f4840 (diff) | |
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
Diffstat (limited to 'test_utils/src')
| -rw-r--r-- | test_utils/src/lib.rs | 13 |
1 files changed, 8 insertions, 5 deletions
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 | |||
| 952 | } | 952 | } |
| 953 | 953 | ||
| 954 | fn backup_existing_config() -> Result<()> { | 954 | fn backup_existing_config() -> Result<()> { |
| 955 | let config_path = get_dirs().config_dir().join("config.json"); | 955 | let config_path = get_dirs().config_dir().join("cache.sqlite"); |
| 956 | let backup_config_path = get_dirs().config_dir().join("config-backup.json"); | 956 | let backup_config_path = get_dirs().config_dir().join("cache-backup.sqlite"); |
| 957 | if !backup_config_path.exists() { | ||
| 958 | std::fs::rename(&config_path, backup_config_path)?; | ||
| 959 | } | ||
| 957 | if config_path.exists() { | 960 | if config_path.exists() { |
| 958 | std::fs::rename(config_path, backup_config_path)?; | 961 | std::fs::remove_file(&config_path)?; |
| 959 | } | 962 | } |
| 960 | Ok(()) | 963 | Ok(()) |
| 961 | } | 964 | } |
| 962 | 965 | ||
| 963 | fn restore_config_backup() -> Result<()> { | 966 | fn restore_config_backup() -> Result<()> { |
| 964 | let config_path = get_dirs().config_dir().join("config.json"); | 967 | let config_path = get_dirs().config_dir().join("cache.sqlite"); |
| 965 | let backup_config_path = get_dirs().config_dir().join("config-backup.json"); | 968 | let backup_config_path = get_dirs().config_dir().join("cache-backup.sqlite"); |
| 966 | if config_path.exists() { | 969 | if config_path.exists() { |
| 967 | std::fs::remove_file(&config_path)?; | 970 | std::fs::remove_file(&config_path)?; |
| 968 | } | 971 | } |