X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=src%2Flib.rs;h=98b6b98725c63aa169acfbdfb3243c0107078cca;hb=09340f28f5e5e8f797a7d2528e5fb2ee3b354c9b;hp=fa08b4fa0c823590dded8256e746c5d126c373bf;hpb=01a080215dded9b84555a87e9a03ccfe9f7b9fa3;p=proxmox-backup.git diff --git a/src/lib.rs b/src/lib.rs index fa08b4fa..98b6b987 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,6 +3,14 @@ //! The [backup](backup/index.html) module contains some detailed information //! on the inner workings of the backup server regarding data storage. +use std::path::PathBuf; + +use proxmox::tools::fs::CreateOptions; + +use pbs_buildcfg::configdir; +use pbs_tools::cert::CertInfo; +use proxmox_rrd::RRDCache; + #[macro_use] pub mod tools; @@ -20,10 +28,33 @@ pub mod auth_helpers; pub mod auth; -pub mod rrd; - pub mod tape; pub mod acme; pub mod client_helpers; + +/// Get the server's certificate info (from `proxy.pem`). +pub fn cert_info() -> Result { + CertInfo::from_path(PathBuf::from(configdir!("/proxy.pem"))) +} + +lazy_static::lazy_static!{ + /// Proxmox Backup Server RRD cache instance + pub static ref RRD_CACHE: RRDCache = { + let backup_user = pbs_config::backup_user().unwrap(); + let file_options = CreateOptions::new() + .owner(backup_user.uid) + .group(backup_user.gid); + + let dir_options = CreateOptions::new() + .owner(backup_user.uid) + .group(backup_user.gid); + + RRDCache::new( + "/var/lib/proxmox-backup/rrdb", + Some(file_options), + Some(dir_options), + ) + }; +}