]> git.proxmox.com Git - proxmox-backup.git/blob - src/lib.rs
5d2b45907837aeda01fdf15dd974f982845e7c3d
[proxmox-backup.git] / src / lib.rs
1 //! See the different modules for documentation on their usage.
2 //!
3 //! The [backup](backup/index.html) module contains some detailed information
4 //! on the inner workings of the backup server regarding data storage.
5
6 use std::path::PathBuf;
7
8 use proxmox::tools::fs::CreateOptions;
9
10 use pbs_buildcfg::configdir;
11 use pbs_tools::cert::CertInfo;
12 use proxmox_rrd::RRDCache;
13
14 #[macro_use]
15 pub mod tools;
16
17 #[macro_use]
18 pub mod server;
19
20 #[macro_use]
21 pub mod backup;
22
23 pub mod config;
24
25 pub mod api2;
26
27 pub mod auth_helpers;
28
29 pub mod auth;
30
31 pub mod tape;
32
33 pub mod acme;
34
35 pub mod client_helpers;
36
37 /// Get the server's certificate info (from `proxy.pem`).
38 pub fn cert_info() -> Result<CertInfo, anyhow::Error> {
39 CertInfo::from_path(PathBuf::from(configdir!("/proxy.pem")))
40 }
41
42 lazy_static::lazy_static!{
43 /// Proxmox Backup Server RRD cache instance
44 pub static ref RRD_CACHE: RRDCache = {
45 let backup_user = pbs_config::backup_user().unwrap();
46 let file_options = CreateOptions::new()
47 .owner(backup_user.uid)
48 .group(backup_user.gid);
49
50 let dir_options = CreateOptions::new()
51 .owner(backup_user.uid)
52 .group(backup_user.gid);
53
54 let apply_interval = 30.0*60.0; // 30 minutes
55
56 RRDCache::new(
57 "/var/lib/proxmox-backup/rrdb",
58 Some(file_options),
59 Some(dir_options),
60 apply_interval,
61 ).unwrap()
62 };
63 }