Skip to content

Commit

Permalink
Merge pull request #318 from r-Techsupport/github-client
Browse files Browse the repository at this point in the history
  • Loading branch information
zleyyij authored Jan 14, 2025
2 parents c9462d2 + 7dc5f3d commit 9418e6c
Show file tree
Hide file tree
Showing 12 changed files with 2,329 additions and 1,530 deletions.
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

0 comments on commit 9418e6c

Please sign in to comment.