summaryrefslogtreecommitdiffstats
path: root/crates/sellershut/src/config/mod.rs
blob: 9ce7b2d487703e867601bf50099f32847f1f9a97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
mod logging;

use std::path::PathBuf;

use clap::Parser;
use logging::LogLevel;

#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
pub struct Cli {
    /// Sets the port the server listens on
    #[arg(default_value_t = 2210, env = "PORT")]
    port: u16,

    /// Sets the port the server listens on
    #[arg(short, long, value_enum, env = "LOG_LEVEL", default_value_t = LogLevel::Debug)]
    log_level: LogLevel,

    /// Sets a custom config file
    #[arg(short, long, value_name = "FILE")]
    config: Option<PathBuf>,
}

impl Cli {
    pub fn log_level(&self) -> tracing::Level {
        self.log_level.into()
    }
}