]>
Commit | Line | Data |
---|---|---|
99be8844 DM |
1 | //! Exports configuration data from the build system |
2 | ||
3 | /// The configured configuration directory | |
653b1ca1 | 4 | pub const CONFIGDIR: &str = "/etc/proxmox-backup"; |
4a7de56e | 5 | pub const JS_DIR: &str = "/usr/share/javascript/proxmox-backup"; |
9f4962d3 | 6 | |
346a488e TL |
7 | #[macro_export] |
8 | macro_rules! PROXMOX_BACKUP_RUN_DIR_M { () => ("/run/proxmox-backup") } | |
9 | ||
10 | #[macro_export] | |
11 | macro_rules! PROXMOX_BACKUP_LOG_DIR_M { () => ("/var/log/proxmox-backup") } | |
12 | ||
58421ec1 SR |
13 | #[macro_export] |
14 | macro_rules! PROXMOX_BACKUP_CACHE_DIR_M { () => ("/var/cache/proxmox-backup") } | |
15 | ||
16 | #[macro_export] | |
17 | macro_rules! PROXMOX_BACKUP_FILE_RESTORE_BIN_DIR_M { | |
18 | () => ("/usr/lib/x86_64-linux-gnu/proxmox-backup/file-restore") | |
19 | } | |
20 | ||
346a488e TL |
21 | /// namespaced directory for in-memory (tmpfs) run state |
22 | pub const PROXMOX_BACKUP_RUN_DIR: &str = PROXMOX_BACKUP_RUN_DIR_M!(); | |
04b053d8 | 23 | |
346a488e TL |
24 | /// namespaced directory for persistent logging |
25 | pub const PROXMOX_BACKUP_LOG_DIR: &str = PROXMOX_BACKUP_LOG_DIR_M!(); | |
26 | ||
d1d74c43 | 27 | /// logfile for all API requests handled by the proxy and privileged API daemons. Note that not all |
4fdf13f9 | 28 | /// failed logins can be logged here with full information, use the auth log for that. |
346a488e | 29 | pub const API_ACCESS_LOG_FN: &str = concat!(PROXMOX_BACKUP_LOG_DIR_M!(), "/api/access.log"); |
8e7e2223 | 30 | |
d1d74c43 | 31 | /// logfile for any failed authentication, via ticket or via token, and new successful ticket |
4fdf13f9 TL |
32 | /// creations. This file can be useful for fail2ban. |
33 | pub const API_AUTH_LOG_FN: &str = concat!(PROXMOX_BACKUP_LOG_DIR_M!(), "/api/auth.log"); | |
34 | ||
04b053d8 TL |
35 | /// the PID filename for the unprivileged proxy daemon |
36 | pub const PROXMOX_BACKUP_PROXY_PID_FN: &str = concat!(PROXMOX_BACKUP_RUN_DIR_M!(), "/proxy.pid"); | |
37 | ||
38 | /// the PID filename for the privileged api daemon | |
39 | pub const PROXMOX_BACKUP_API_PID_FN: &str = concat!(PROXMOX_BACKUP_RUN_DIR_M!(), "/api.pid"); | |
40 | ||
58421ec1 SR |
41 | /// filename of the cached initramfs to use for booting single file restore VMs, this file is |
42 | /// automatically created by APT hooks | |
43 | pub const PROXMOX_BACKUP_INITRAMFS_FN: &str = | |
44 | concat!(PROXMOX_BACKUP_CACHE_DIR_M!(), "/file-restore-initramfs.img"); | |
45 | ||
46 | /// filename of the kernel to use for booting single file restore VMs | |
47 | pub const PROXMOX_BACKUP_KERNEL_FN: &str = | |
48 | concat!(PROXMOX_BACKUP_FILE_RESTORE_BIN_DIR_M!(), "/bzImage"); | |
49 | ||
99be8844 DM |
50 | /// Prepend configuration directory to a file name |
51 | /// | |
52 | /// This is a simply way to get the full path for configuration files. | |
53 | /// #### Example: | |
54 | /// ``` | |
55 | /// # #[macro_use] extern crate proxmox_backup; | |
56 | /// let cert_path = configdir!("/proxy.pfx"); | |
57 | /// ``` | |
9f4962d3 WB |
58 | #[macro_export] |
59 | macro_rules! configdir { | |
4a7de56e | 60 | ($subdir:expr) => (concat!("/etc/proxmox-backup", $subdir)) |
9f4962d3 | 61 | } |
96918252 WB |
62 | |
63 | /// Prepend the run directory to a file name. | |
64 | /// | |
65 | /// This is a simply way to get the full path for files in `/run`. | |
66 | #[macro_export] | |
67 | macro_rules! rundir { | |
68 | ($subdir:expr) => { | |
69 | concat!(PROXMOX_BACKUP_RUN_DIR_M!(), $subdir) | |
70 | }; | |
71 | } |