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 PANIC_CRITICAL_SERVICE_ERROR: &str =
25 "A service critical to Cuprate's function returned an unexpected error.";
26
27pub const DEFAULT_CONFIG_WARNING: &str = formatcp!(
28 "WARNING: no config file found, using default config.\
29 \nThe default config may not be optimal for your setup, see the user book here: https://user.cuprate.org/.\
30 \nPausing startup for {} seconds. \
31 \nUse the `--skip-config-warning` arg to skip this delay if you really want to use the default.",
32 DEFAULT_CONFIG_STARTUP_DELAY.as_secs()
33);
34
35pub const DEFAULT_CONFIG_STARTUP_DELAY: Duration = Duration::from_secs(15);
36
37pub const EXAMPLE_CONFIG: &str = include_str!("../config/Cuprated.toml");
38
39#[cfg(test)]
40mod test {
41 use super::*;
42 use crate::config::Config;
43
44 #[test]
45 fn version() {
46 let semantic_version = format!("{MAJOR_VERSION}.{MINOR_VERSION}.{PATCH_VERSION}");
47 assert_eq!(VERSION, VERSION);
48 assert_eq!(VERSION, "0.0.1");
49 }
50
51 #[test]
52 fn version_build() {
53 if cfg!(debug_assertions) {
54 assert_eq!(VERSION_BUILD, "0.0.1-debug");
55 } else {
56 assert_eq!(VERSION_BUILD, "0.0.1-release");
57 }
58 }
59}