1use std::time::Duration;
3
4use const_format::formatcp;
5
6pub const VERSION: &str = clap::crate_version!();
8
9pub const MAJOR_VERSION: &str = env!("CARGO_PKG_VERSION_MAJOR");
11
12pub const MINOR_VERSION: &str = env!("CARGO_PKG_VERSION_MINOR");
14
15pub const PATCH_VERSION: &str = env!("CARGO_PKG_VERSION_PATCH");
17
18pub const VERSION_BUILD: &str = formatcp!("{VERSION}-{}", cuprate_constants::build::BUILD);
22
23pub const DEFAULT_CONFIG_WARNING: &str = formatcp!(
24 "WARNING: no config file found, using default config.\
25 \nThe default config may not be optimal for your setup, see the user book here: https://user.cuprate.org/.\
26 \nPausing startup for {} seconds. \
27 \nUse the `--skip-config-warning` arg to skip this delay if you really want to use the default.",
28 DEFAULT_CONFIG_STARTUP_DELAY.as_secs()
29);
30
31pub const DEFAULT_CONFIG_STARTUP_DELAY: Duration = Duration::from_secs(15);
32
33pub const DATABASE_CORRUPT_MSG: &str = r"`cuprated` has encountered a fatal error. The database may be corrupted.
40
41If `cuprated` continues to crash with the current database,
42you may have to delete the database file and re-sync from scratch.
43
44See <https://user.cuprate.org/resources/disk.html>
45for more information on where database files are.
46
47If this happens frequently, consider using the `Safe` sync mode.";
48
49#[cfg(test)]
50mod test {
51 use super::*;
52
53 #[test]
54 fn version_build() {
55 if cfg!(debug_assertions) {
56 assert_eq!(VERSION_BUILD, "0.1.0-preview-debug");
57 } else {
58 assert_eq!(VERSION_BUILD, "0.1.0-preview-release");
59 }
60 }
61}