Skip to content

Commit 0f2319d

Browse files
committed
fix(server): answer --version and --help instead of starting the server
1 parent 9786e1e commit 0f2319d

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

‎Cargo.lock‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎server/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ thiserror.workspace = true
4040
jsonwebtoken.workspace = true
4141
tracing.workspace = true
4242
tracing-subscriber.workspace = true
43+
clap.workspace = true
4344
tracing-opentelemetry.workspace = true
4445
opentelemetry.workspace = true
4546
opentelemetry_sdk.workspace = true

‎server/src/main.rs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1+
use clap::Parser;
12
use lfsx_server::config::Config;
23
use tokio::net::TcpListener;
34

5+
// No arguments on purpose: everything is configured through the environment.
6+
// The parser still earns its place, because a daemon that ignores `--version`
7+
// starts serving when somebody only asked what is installed, and a packaging
8+
// smoke test (`versionCheckHook` and its Debian, Homebrew and Arch cousins)
9+
// has nothing to call. Stray arguments are refused for the same reason.
10+
#[derive(Parser)]
11+
#[command(
12+
name = "lfsx-server",
13+
version,
14+
about = "A fast, lightweight, secure Git LFS server",
15+
after_help = "Configuration is environment variables only; see https://lfsx.dev/docs/configuration"
16+
)]
17+
struct Cli {}
18+
419
#[tokio::main]
520
async fn main() -> Result<(), Box<dyn std::error::Error>> {
21+
Cli::parse();
622
let telemetry = lfsx_server::telemetry::init();
723

824
let mut config = Config::from_env();

0 commit comments

Comments
 (0)