You are browsing as a guest. Sign up (or log in) to start making projects!

2h 0m logged

Implement server main entry point with clap CLI and fix listener/handler compilation

Add a complete main.rs for pwr-server with three clap subcommands. The
init subcommand detects or accepts a hostname, delegates to cert::init_server
for TLS certificate generation, PSK creation, and config file writing, then
prints the start command. The start subcommand locates the config file via
the standard search path, loads and validates the ServerConfig, logs the
bind address and storage path via tracing, and calls listener::run to begin
accepting connections (blocks until shutdown). The status subcommand loads
the config and prints a summary of all settings plus a connectivity check
by attempting a brief TCP connection to the configured port, reporting
whether the server appears to be running.

Logging is configured via tracing-subscriber with an env-filter defaulting
to pwr_server=info, controllable via the RUST_LOG environment variable.
The –foreground flag on the start subcommand is accepted but daemonization
is not yet implemented.

Fix two compilation errors discovered during integration. The listener’s
TLS setup incorrectly pattern-matched rustls::StreamOwned::new as if it
returned a Result; it returns the stream directly in rustls 0.23.
The handler’s handle_archive_finish had a borrow conflict where the
session reference from the Archiving state match arm prevented reassigning
*state; the fix extracts project_uuid and project_name into local
variables before the state transition.

0
2

Comments 0

No comments yet. Be the first!