smbcloud_utils/
config.rs

1use {
2    serde::{Deserialize, Serialize},
3    smbcloud_model::project::Project,
4};
5
6/// smbCloud config from the .smb/config.toml file.
7#[derive(Deserialize, Serialize)]
8pub struct Config {
9    pub name: String,
10    pub description: Option<String>,
11    pub project: Project,
12}
13
14impl Config {
15    pub fn ssh_key_path(&self, user_id: i32) -> String {
16        // Use the dirs crate to get the home directory
17        let home = dirs::home_dir().expect("Could not determine home directory");
18        let key_path = home.join(".ssh").join(format!("id_{}@smbcloud", user_id));
19        let key_path_str = key_path.to_string_lossy().to_string();
20        println!("Use key path: {}", key_path_str);
21        key_path_str
22    }
23}