Skip to main content

nexus_common/config/
mod.rs

1use serde::{Deserialize, Serialize};
2use std::fmt::Debug;
3
4pub const LOG_LEVEL: Level = Level::Info;
5pub const FILES_DIR: &str = "~/.pubky-nexus/static/files";
6// All the tests run inside their own crate therefore the default directory does not apply
7pub const FILES_DIR_TEST: &str = "./static/files";
8
9mod api;
10mod daemon;
11pub mod file;
12mod stack;
13mod watcher;
14
15pub use api::ApiConfig;
16pub use daemon::DaemonConfig;
17pub use stack::{default_stack, StackConfig};
18pub use watcher::WatcherConfig;
19
20#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
21#[serde(rename_all = "lowercase")]
22pub enum Level {
23    /// Designates very low priority, often extremely verbose, information.
24    Trace,
25    /// Designates lower priority information.
26    Debug,
27    /// Designates useful information.
28    Info,
29    /// Designates hazardous situations.
30    Warn,
31    /// Designates very serious errors.
32    Error,
33}
34
35impl Level {
36    pub fn as_str(&self) -> &'static str {
37        match self {
38            Level::Trace => "trace",
39            Level::Debug => "debug",
40            Level::Info => "info",
41            Level::Warn => "warn",
42            Level::Error => "error",
43        }
44    }
45}