36 lines
767 B
Rust
36 lines
767 B
Rust
use structopt::StructOpt;
|
|
use std::path::PathBuf;
|
|
use serde::Deserialize;
|
|
|
|
const DEFAULT_DATABASE_PATH: &'static str = "/var/lib/noise-server/noise-server.sqlite";
|
|
|
|
#[derive(Debug, StructOpt)]
|
|
struct Options {
|
|
#[structopt(short, long, default_value = "/etc/noise-server/config.toml")]
|
|
config: PathBuf,
|
|
|
|
#[structopt(short, long, default_value = DEFAULT_DATABASE_PATH)]
|
|
database_path: PathBuf,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
#[serde(default)]
|
|
struct Config {
|
|
database_path: PathBuf,
|
|
|
|
}
|
|
|
|
impl Default for Config {
|
|
fn default() -> Self {
|
|
Config {
|
|
database_path: DEFAULT_DATABASE_PATH.into(),
|
|
}
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let options = Options::from_args();
|
|
#[cfg(debug_assertions)]
|
|
println!("{:?}", options);
|
|
}
|