Skip to main content

faucet_cli/commands/
serve.rs

1//! `faucet serve` — thin command layer: parse args into a `ServeConfig`, load
2//! the startup `.env`, and hand off to `serve::run_server`.
3
4use crate::cli::ServeArgs;
5use crate::error::CliResult;
6use crate::serve::ServeConfig;
7
8pub async fn run(args: ServeArgs, log_level: String) -> CliResult<()> {
9    let cwd = std::env::current_dir()?;
10    let env_path =
11        crate::env_loader::resolve_env_file(args.env_file.as_deref(), args.no_env_file, &cwd)?;
12    crate::env_loader::load_env_file_if_present(env_path.as_deref())?;
13    let mut config = ServeConfig::from_args(args)?;
14    config.log_level = log_level;
15    crate::serve::run_server(config).await
16}