-pub mod static_map;
-
-/// API definition helper
-///
-/// This module contains helper classes to define REST APIs. Method
-/// parameters and return types are described using a
-/// [Schema](schema/enum.Schema.html).
-///
-/// The [Router](router/struct.Router.html) is used to define a
-/// hierarchy of API entries, and provides ways to find an API
-/// definition by path.
+//! See the different modules for documentation on their usage.
+//!
+//! The [backup](backup/index.html) module contains some detailed information
+//! on the inner workings of the backup server regarding data storage.
-pub mod tools;
-
-#[macro_use]
-pub mod api {
-
- #[macro_use]
- pub mod schema;
- pub mod registry;
- #[macro_use]
- pub mod router;
- pub mod config;
-}
+use std::path::PathBuf;
-pub mod server {
+use proxmox::tools::fs::CreateOptions;
- pub mod formatter;
- pub mod rest;
+use pbs_buildcfg::configdir;
+use pbs_tools::cert::CertInfo;
+use proxmox_rrd::RRDCache;
-}
+#[macro_use]
+pub mod tools;
-pub mod section_config;
+#[macro_use]
+pub mod server;
-pub mod backup {
+#[macro_use]
+pub mod backup;
- pub mod chunk_store;
- pub mod image_index;
- pub mod datastore;
-}
+pub mod config;
-pub mod config {
+pub mod api2;
- pub mod datastore;
-}
+pub mod auth_helpers;
-pub mod storage {
+pub mod auth;
- pub mod config;
- pub mod futures;
-}
+pub mod tape;
-pub mod getopts;
+pub mod acme;
-pub mod cli {
+pub mod client_helpers;
- pub mod command;
+/// Get the server's certificate info (from `proxy.pem`).
+pub fn cert_info() -> Result<CertInfo, anyhow::Error> {
+ CertInfo::from_path(PathBuf::from(configdir!("/proxy.pem")))
}
-
-pub mod api3;
+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),
+ )
+ };
+}