move clap; fix version
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
74832bdc47
commit
2dd5cf8c68
4 changed files with 11 additions and 10 deletions
|
@ -13,7 +13,6 @@ use tracing::debug;
|
||||||
|
|
||||||
use crate::{Error, Result};
|
use crate::{Error, Result};
|
||||||
|
|
||||||
pub mod clap;
|
|
||||||
pub mod content_disposition;
|
pub mod content_disposition;
|
||||||
pub mod defer;
|
pub mod defer;
|
||||||
|
|
||||||
|
|
|
@ -2,19 +2,18 @@
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
pub use clap::Parser;
|
use clap::Parser;
|
||||||
|
use conduit_core::utils::conduwuit_version;
|
||||||
use super::conduwuit_version;
|
|
||||||
|
|
||||||
/// Commandline arguments
|
/// Commandline arguments
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[clap(version = conduwuit_version(), about, long_about = None)]
|
#[clap(version = conduwuit_version(), about, long_about = None)]
|
||||||
pub struct Args {
|
pub(crate) struct Args {
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
/// Optional argument to the path of a conduwuit config TOML file
|
/// Optional argument to the path of a conduwuit config TOML file
|
||||||
pub config: Option<PathBuf>,
|
pub(crate) config: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse commandline arguments into structured data
|
/// Parse commandline arguments into structured data
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn parse() -> Args { Args::parse() }
|
pub(crate) fn parse() -> Args { Args::parse() }
|
|
@ -1,3 +1,4 @@
|
||||||
|
pub(crate) mod clap;
|
||||||
mod mods;
|
mod mods;
|
||||||
mod server;
|
mod server;
|
||||||
|
|
||||||
|
@ -5,7 +6,7 @@ extern crate conduit_core as conduit;
|
||||||
|
|
||||||
use std::{cmp, sync::Arc, time::Duration};
|
use std::{cmp, sync::Arc, time::Duration};
|
||||||
|
|
||||||
use conduit::{debug_info, error, utils::clap, Error, Result};
|
use conduit::{debug_info, error, Error, Result};
|
||||||
use server::Server;
|
use server::Server;
|
||||||
use tokio::runtime;
|
use tokio::runtime;
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,14 @@ use conduit::{
|
||||||
config::Config,
|
config::Config,
|
||||||
info,
|
info,
|
||||||
log::{LogLevelReloadHandles, ReloadHandle},
|
log::{LogLevelReloadHandles, ReloadHandle},
|
||||||
utils::{clap, maximize_fd_limit},
|
utils::maximize_fd_limit,
|
||||||
Error, Result,
|
Error, Result,
|
||||||
};
|
};
|
||||||
use tokio::runtime;
|
use tokio::runtime;
|
||||||
use tracing_subscriber::{prelude::*, reload, EnvFilter, Registry};
|
use tracing_subscriber::{prelude::*, reload, EnvFilter, Registry};
|
||||||
|
|
||||||
|
use crate::clap::Args;
|
||||||
|
|
||||||
/// Server runtime state; complete
|
/// Server runtime state; complete
|
||||||
pub(crate) struct Server {
|
pub(crate) struct Server {
|
||||||
/// Server runtime state; public portion
|
/// Server runtime state; public portion
|
||||||
|
@ -27,7 +29,7 @@ pub(crate) struct Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Server {
|
impl Server {
|
||||||
pub(crate) fn build(args: clap::Args, runtime: Option<&runtime::Handle>) -> Result<Arc<Server>, Error> {
|
pub(crate) fn build(args: Args, runtime: Option<&runtime::Handle>) -> Result<Arc<Server>, Error> {
|
||||||
let config = Config::new(args.config)?;
|
let config = Config::new(args.config)?;
|
||||||
#[cfg(feature = "sentry_telemetry")]
|
#[cfg(feature = "sentry_telemetry")]
|
||||||
let sentry_guard = init_sentry(&config);
|
let sentry_guard = init_sentry(&config);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue