2022-03-29 17:32:31 +00:00
|
|
|
use std::path::{Path, PathBuf};
|
2022-03-30 08:14:39 +00:00
|
|
|
|
|
|
|
use clap::Parser;
|
|
|
|
|
2022-03-29 17:32:31 +00:00
|
|
|
use crate::constants::USERS_LIST_FILE;
|
|
|
|
|
2022-03-30 08:14:39 +00:00
|
|
|
/// Basic OIDC provider
|
|
|
|
#[derive(Parser, Debug)]
|
|
|
|
#[clap(author, version, about, long_about = None)]
|
2022-03-29 17:32:31 +00:00
|
|
|
pub struct AppConfig {
|
2022-03-30 08:14:39 +00:00
|
|
|
/// Listen address
|
|
|
|
#[clap(short, long, env, default_value = "0.0.0.0:8000")]
|
|
|
|
pub listen_address: String,
|
|
|
|
|
|
|
|
/// Storage path
|
|
|
|
#[clap(short, long, env)]
|
|
|
|
pub storage_path: String,
|
2022-03-29 17:32:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl AppConfig {
|
|
|
|
pub fn storage_path(&self) -> &Path {
|
|
|
|
self.storage_path.as_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn users_file(&self) -> PathBuf {
|
2022-03-30 08:14:39 +00:00
|
|
|
self.storage_path().join(USERS_LIST_FILE)
|
2022-03-29 17:32:31 +00:00
|
|
|
}
|
|
|
|
}
|