Skip to content

Commit

Permalink
Fix bug causing compilation error on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
wa5i committed Nov 27, 2023
1 parent affcf63 commit c370cd1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ clap = { version = "4.4", features = ["wrap_help", "suggestions"] }
sysexits = { version = "0.7", features = ["std"] }
build-time = "0.1"
hcl-rs = "0.16"
daemonize = "0.5"
actix-web = { version = "4.4", features = ["openssl"] }
actix-tls = "3.1"
actix-rt = "2.9"
Expand All @@ -40,6 +39,9 @@ as-any = "0.3.1"
pem = "3.0"
chrono = "0.4"

[target.'cfg(unix)'.dependencies]
daemonize = "0.5"

[dependencies.foreign-types]
version = "0.3.1"

Expand Down
4 changes: 2 additions & 2 deletions src/cli/command/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::{
path::Path,
sync::{Arc, RwLock}
};
use daemonize::Daemonize;
use clap::{ArgMatches};
use sysexits::ExitCode;
use actix_web::{
Expand Down Expand Up @@ -52,6 +51,7 @@ pub fn main(config_path: &str) -> Result<(), RvError> {
fs::create_dir_all(work_dir.as_str())?;
}

#[cfg(not(windows))]
if config.daemon {
// start daemon
let log_path = format!("{}/rusty_vault.log", work_dir);
Expand Down Expand Up @@ -79,7 +79,7 @@ pub fn main(config_path: &str) -> Result<(), RvError> {
.open(log_path)
.unwrap();

let daemonize = Daemonize::new()
let daemonize = daemonize::Daemonize::new()
.working_directory(work_dir.as_str())
.user(user.as_str())
.group(group.as_str())
Expand Down
15 changes: 8 additions & 7 deletions src/storage/barrier_aes_gcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,12 @@ mod test {
assert!(keys.is_ok());
let keys = keys.unwrap();
assert_eq!(keys.len(), 3);
assert_eq!(keys[0], "bar".to_string());
assert_eq!(keys[1], "barrier/".to_string());
assert_eq!(keys[2], "bar/".to_string());
assert!(keys.join("") == "barbarrier/bar/"
|| keys.join("") == "barbar/barrier/"
|| keys.join("") == "bar/barbarrier/"
|| keys.join("") == "barrier/bar/bar"
|| keys.join("") == "barrier/barbar/"
|| keys.join("") == "bar/barrier/bar");
let get = barrier.get("bar");
assert!(get.is_ok());
assert_eq!(get.unwrap().unwrap().value, "test1".as_bytes());
Expand All @@ -517,8 +520,7 @@ mod test {
assert!(keys.is_ok());
let keys = keys.unwrap();
assert_eq!(keys.len(), 2);
assert_eq!(keys[0], "foo".to_string());
assert_eq!(keys[1], "foo/".to_string());
assert!(keys.join("") == "foofoo/" || keys.join("") == "foo/foo");
let get = barrier.get("bar/foo");
assert!(get.is_ok());
assert_eq!(get.unwrap().unwrap().value, "test2".as_bytes());
Expand Down Expand Up @@ -548,8 +550,7 @@ mod test {
assert!(keys.is_ok());
let keys = keys.unwrap();
assert_eq!(keys.len(), 2);
assert_eq!(keys[0], "barrier/".to_string());
assert_eq!(keys[1], "bar/".to_string());
assert!(keys.join("") == "barrier/bar/" || keys.join("") == "bar/barrier/");

let seal = barrier.seal();
assert!(seal.is_ok());
Expand Down
6 changes: 2 additions & 4 deletions src/storage/physical/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,14 @@ mod test {
assert!(keys.is_ok());
let keys = keys.unwrap();
assert_eq!(keys.len(), 2);
assert_eq!(keys[0], "bar".to_string());
assert_eq!(keys[1], "bar/".to_string());
assert!(keys.join("") == "barbar/" || keys.join("") == "bar/bar");

// Scan bar/
let keys = backend.list("bar/");
assert!(keys.is_ok());
let keys = keys.unwrap();
assert_eq!(keys.len(), 2);
assert_eq!(keys[0], "foo".to_string());
assert_eq!(keys[1], "foo/".to_string());
assert!(keys.join("") == "foofoo/" || keys.join("") == "foo/foo");

// Scan bar/foo/
let keys = backend.list("bar/foo/");
Expand Down

0 comments on commit c370cd1

Please sign in to comment.