mirror of https://github.com/breard-r/acmed.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
530 B
22 lines
530 B
use daemonize::Daemonize;
|
|
|
|
pub mod error;
|
|
pub mod gen;
|
|
pub mod logs;
|
|
|
|
pub fn b64_encode<T: ?Sized + AsRef<[u8]>>(input: &T) -> String {
|
|
base64::encode_config(input, base64::URL_SAFE_NO_PAD)
|
|
}
|
|
|
|
pub fn init_server(foreground: bool, pid_file: &str) {
|
|
if !foreground {
|
|
let daemonize = Daemonize::new().pid_file(pid_file);
|
|
match daemonize.start() {
|
|
Ok(_) => {}
|
|
Err(e) => {
|
|
eprintln!("Error: {}", e);
|
|
std::process::exit(3);
|
|
}
|
|
}
|
|
}
|
|
}
|