Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub client #318

Merged
merged 16 commits into from
Jan 14, 2025
Merged
2 changes: 1 addition & 1 deletion backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repository = "https://github.com/r-Techsupport/hyde"
readme = "../README.md"
keywords = ["cms", "wiki"]
categories = ["web-programming"]
rust-version = "1.75.0"
rust-version = "1.80.0"

[dependencies]
axum = { version = "0.8.1", features = ["http2", "macros"] }
Expand Down
11 changes: 6 additions & 5 deletions backend/src/app_conf.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use color_eyre::eyre::ContextCompat;
use color_eyre::Result;
use serde::Deserialize;
use std::ffi::OsStr;
use std::path::PathBuf;
use std::{fs, path::Path};
use std::fmt::Debug;
use std::path::PathBuf;
use std::sync::Arc;
use std::{fs, path::Path};
use tracing::{info, trace};
use color_eyre::Result;

#[derive(Deserialize, Debug, Clone, Default, PartialEq, Eq)]
pub struct AppConf {
Expand Down Expand Up @@ -103,15 +103,16 @@ impl ValidateFields for AppConf {
}
impl AppConf {
/// Deserializes the config located at `path`.
///
///
/// If a file is passed, it will load that file. If a directory is passed,
/// then it'll search that directory for any `.toml` file.
pub fn load<P: AsRef<Path> + Copy + Debug>(path: P) -> Result<Arc<Self>> {
let file_metadata = fs::metadata(path)?;
let config_path: PathBuf = if file_metadata.is_file() {
path.as_ref().to_path_buf()
} else {
locate_config_file(path)?.wrap_err_with(|| format!("No config was found in the {path:?} directory"))?
locate_config_file(path)?
.wrap_err_with(|| format!("No config was found in the {path:?} directory"))?
};
let serialized_config = fs::read_to_string(config_path)?;
let config: Self = toml::from_str(&serialized_config)?;
Expand Down
6 changes: 5 additions & 1 deletion backend/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,11 @@ mod tests {
let admin_permissions = mock_db.get_group_permissions(1).await.unwrap();
assert_eq!(
admin_permissions,
vec![Permission::ManageContent, Permission::ManageUsers, Permission::ManageBranches],
vec![
Permission::ManageContent,
Permission::ManageUsers,
Permission::ManageBranches
],
"admin group should have the right permissions"
);
}
Expand Down
Loading
Loading