Skip to content

Commit

Permalink
chore: drop password support (#6)
Browse files Browse the repository at this point in the history
* test flag for all workspaces

* drop password
  • Loading branch information
ssddOnTop authored Apr 15, 2024
1 parent f37f63e commit 0cf7d32
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 20 deletions.
5 changes: 0 additions & 5 deletions generated/.spacepls.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
"default": null,
"description": "The directory path to store files.",
"type": ["string", "null"]
},
"password": {
"default": null,
"description": "Password",
"type": ["string", "null"]
}
},
"type": "object"
Expand Down
5 changes: 0 additions & 5 deletions src/blueprint/blueprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pub struct Blueprint {
pub server: Server,
pub upstream: Upstream,
pub dir_path: String,
pub password: String,
}

impl TryFrom<&Config> for Blueprint {
Expand All @@ -21,14 +20,10 @@ impl TryFrom<&Config> for Blueprint {
config.extensions.dir_path.clone().context(
"No dir path found in config, use config reader to read config instead.",
)?;
let password = config.extensions.password.clone().context(
"No password for the files provided. Use config reader to read config instead.",
)?;
Ok(Self {
server,
upstream,
dir_path,
password,
})
}
}
11 changes: 2 additions & 9 deletions src/config/extensions.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
use derive_setters::Setters;
use serde::{Deserialize, Serialize};

#[derive(
Serialize, Deserialize, Clone, Debug, Default, Setters, PartialEq, Eq, schemars::JsonSchema,
)]
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, Eq, schemars::JsonSchema)]
/// Used to store crucial information like
/// password and dir path
pub struct Extensions {
/// The directory path to store files.
#[serde(default)]
pub dir_path: Option<String>,
/// Password
#[serde(default)]
pub password: Option<String>,
}

impl Extensions {
pub(crate) fn merge_right(self, other: Extensions) -> Extensions {
let dir_path = other.clone().dir_path.or(self.dir_path);
let password = other.clone().password.or(self.password);
Self { dir_path, password }
Self { dir_path }
}
}
1 change: 0 additions & 1 deletion src/config/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ impl ConfigReader {
let dir = config.extensions.dir_path.unwrap_or("spacepls".to_string());
let dir = Self::resolve_path(&dir, parent_dir);
config.extensions.dir_path = Some(dir);
config.extensions.password = Some("$Xme-Ef9r[@EsqF".to_string()); // randomly generated password

config
}
Expand Down

0 comments on commit 0cf7d32

Please sign in to comment.