Author: Blair Noctis <ncts@debian.org>
Last-Update: 2025-03-04
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -60,3 +60,3 @@
 [dependencies.config]
-version = "0.11.0"
+version = "0.15"
 features = ["toml"]
--- a/src/pass.rs
+++ b/src/pass.rs
@@ -1254,3 +1254,3 @@
                 if let Some(p) = password_store_dir_opt {
-                    let p_path = PathBuf::from(p.clone().into_str().unwrap());
+                    let p_path = PathBuf::from(p.clone().into_string().unwrap());
                     let c1 = std::fs::canonicalize(home_dir.clone());
@@ -1307,4 +1307,5 @@
 
-    let mut new_settings = config::Config::default();
-    new_settings.set("stores", stores_map)?;
+    let new_settings = config::Config::builder()
+        .set_override("stores", stores_map)?
+        .build()?;
 
@@ -1335,4 +1336,5 @@
 
-    let mut new_settings = config::Config::default();
-    new_settings.set("stores", stores_map)?;
+    let new_settings = config::Config::builder()
+        .set_override("stores", stores_map)?
+        .build()?;
 
@@ -1357,3 +1359,3 @@
 
-fn file_settings(xdg_config_file: &Path) -> config::File<config::FileSourceFile> {
+fn file_settings(xdg_config_file: &Path) -> config::File<config::FileSourceFile, config::FileFormat> {
     config::File::from(xdg_config_file.to_path_buf())
@@ -1374,3 +1376,3 @@
 ) -> Result<(config::Config, PathBuf)> {
-    let mut settings = config::Config::default();
+    let mut settings = config::Config::builder();
     let config_file_location = xdg_config_file_location(home, xdg_config_home)?;
@@ -1378,7 +1380,7 @@
     if settings_file_exists(home, xdg_config_home) {
-        settings.merge(file_settings(&config_file_location))?;
+        settings = settings.add_source(file_settings(&config_file_location));
     }
 
-    if home_exists(home, &settings) {
-        settings.merge(home_settings(home)?)?;
+    if home_exists(home, &settings.clone().build()?) {
+        settings = settings.add_source(home_settings(home)?);
     }
@@ -1386,6 +1388,6 @@
     if env_var_exists(store_dir, signing_keys) {
-        settings.merge(var_settings(store_dir, signing_keys)?)?;
+        settings = settings.add_source(var_settings(store_dir, signing_keys)?);
     }
 
-    Ok((settings, config_file_location))
+    Ok((settings.build()?, config_file_location))
 }
--- a/src/tests/pass.rs
+++ b/src/tests/pass.rs
@@ -414,3 +414,3 @@
     let work = stores["default"].clone().into_table()?;
-    let path = work["path"].clone().into_str()?;
+    let path = work["path"].clone().into_string()?;
 
@@ -437,3 +437,3 @@
     let work = stores["default"].clone().into_table()?;
-    let path = work["path"].clone().into_str()?;
+    let path = work["path"].clone().into_string()?;
 
@@ -460,4 +460,4 @@
     let work = stores["default"].clone().into_table()?;
-    let path = work["path"].clone().into_str()?;
-    let valid_signing_keys = work["valid_signing_keys"].clone().into_str()?;
+    let path = work["path"].clone().into_string()?;
+    let valid_signing_keys = work["valid_signing_keys"].clone().into_string()?;
 
@@ -489,6 +489,7 @@
 
-    let mut settings: config::Config = config::Config::default();
-    settings.merge(file_settings(
-        &xdg_config_file_location(&Some(dir.into_path()), &None).unwrap(),
-    ))?;
+    let mut settings: config::Config = config::Config::builder()
+        .add_source(file_settings(
+            &xdg_config_file_location(&Some(dir.into_path()), &None).unwrap(),
+        ))
+        .build()?;
 
@@ -497,3 +498,3 @@
     let work = stores["work"].clone().into_table()?;
-    let path = work["path"].clone().into_str()?;
+    let path = work["path"].clone().into_string()?;
     assert_eq!("/home/user/.password-store", path);
@@ -521,7 +522,8 @@
 
-    let mut settings: config::Config = config::Config::default();
-    settings.merge(file_settings(&xdg_config_file_location(
-        &Some(dir.into_path()),
-        &Some(dir2.path().join(".random_config")),
-    )?))?;
+    let settings: config::Config = config::Config::builder()
+        .add_source(file_settings(&xdg_config_file_location(
+            &Some(dir.into_path()),
+            &Some(dir2.path().join(".random_config")),
+        )?))
+        .build()?;
 
@@ -530,3 +532,3 @@
     let work = stores["work"].clone().into_table()?;
-    let path = work["path"].clone().into_str()?;
+    let path = work["path"].clone().into_string()?;
     assert_eq!("/home/user/.password-store", path);
@@ -552,3 +554,3 @@
     let work = stores["default"].clone().into_table()?;
-    let path = work["path"].clone().into_str()?;
+    let path = work["path"].clone().into_string()?;
 
@@ -580,4 +582,4 @@
     let work = stores["default"].clone().into_table()?;
-    let path = work["path"].clone().into_str()?;
-    let valid_signing_keys = work["valid_signing_keys"].clone().into_str()?;
+    let path = work["path"].clone().into_string()?;
+    let valid_signing_keys = work["valid_signing_keys"].clone().into_string()?;
 
@@ -620,4 +622,4 @@
     let work = stores["default"].clone().into_table()?;
-    let path = work["path"].clone().into_str()?;
-    let valid_signing_keys = work["valid_signing_keys"].clone().into_str()?;
+    let path = work["path"].clone().into_string()?;
+    let valid_signing_keys = work["valid_signing_keys"].clone().into_string()?;
 
@@ -662,4 +664,4 @@
     let work = stores["default"].clone().into_table()?;
-    let path = work["path"].clone().into_str()?;
-    let valid_signing_keys = work["valid_signing_keys"].clone().into_str()?;
+    let path = work["path"].clone().into_string()?;
+    let valid_signing_keys = work["valid_signing_keys"].clone().into_string()?;
 
@@ -710,3 +712,3 @@
     let work = stores["work"].clone().into_table()?;
-    let path = work["path"].clone().into_str()?;
+    let path = work["path"].clone().into_string()?;
     assert_eq!(dir.path().join(".password-store").to_str().unwrap(), path);
@@ -750,4 +752,4 @@
     let work = stores["default"].clone().into_table()?;
-    let path = work["path"].clone().into_str()?;
-    let keys = work["valid_signing_keys"].clone().into_str()?;
+    let path = work["path"].clone().into_string()?;
+    let keys = work["valid_signing_keys"].clone().into_string()?;
     assert_eq!("/tmp/t2/", path);
@@ -792,10 +794,10 @@
     let work = stores["default"].clone().into_table()?;
-    let path = work["path"].clone().into_str()?;
-    let keys = work["valid_signing_keys"].clone().into_str()?;
+    let path = work["path"].clone().into_string()?;
+    let keys = work["valid_signing_keys"].clone().into_string()?;
     assert_eq!("/tmp/t2/", path);
     assert_eq!("-1", keys);
-    assert_eq!("gpg", work["pgp_implementation"].clone().into_str()?);
+    assert_eq!("gpg", work["pgp_implementation"].clone().into_string()?);
     assert_eq!(
         "7E068070D5EF794B00C8A9D91D108E6C07CBC406",
-        work["own_fingerprint"].clone().into_str()?
+        work["own_fingerprint"].clone().into_string()?
     );
