pub struct ServerConfig {
pub version: u32,
pub listen_address: String,
pub listen_port: u16,
pub storage_base_path: PathBuf,
pub max_project_size_gb: u64,
pub tls_cert_path: PathBuf,
pub tls_key_path: PathBuf,
pub auth_token: String,
pub max_connections: usize,
pub idle_timeout_secs: u64,
}Expand description
Server-side configuration, typically stored at /etc/pwr/server.toml
or ~/.config/pwr/server.toml.
Controls the TLS listener, project storage backend, authentication, and operational limits for the pwr-server daemon.
Fields§
§version: u32Schema version for forward compatibility.
listen_address: StringIP address to bind the TCP listener to (e.g., “0.0.0.0” for all interfaces, or “127.0.0.1” for local-only access).
listen_port: u16TCP port to listen on. Defaults to 9742, an unprivileged port not assigned by IANA.
storage_base_path: PathBufFilesystem path where project archives are stored. The server creates per-project subdirectories under this root.
max_project_size_gb: u64Maximum size in gigabytes allowed for a single project archive. Archives exceeding this limit are rejected before transfer begins.
tls_cert_path: PathBufPath to the PEM-encoded TLS certificate file.
Generated during pwr-server init if not provided.
tls_key_path: PathBufPath to the PEM-encoded TLS private key file. Must be readable only by the server process (mode 0o600).
auth_token: StringHex-encoded 256-bit pre-shared key for client authentication. Must match the value in the client’s config.toml.
max_connections: usizeMaximum number of concurrent client connections. Additional connections are accepted but immediately closed with a rate-limit error.
idle_timeout_secs: u64Idle timeout in seconds for authenticated connections. Connections with no activity for this duration are closed.
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validate the configuration for common mistakes.
Checks that required paths exist (or can be created), the port is in the valid range, the auth token is non-empty, and size limits are reasonable.
Sourcepub fn project_dir(&self, uuid: &Uuid) -> PathBuf
pub fn project_dir(&self, uuid: &Uuid) -> PathBuf
Return the path where a specific project’s data is stored.
Sourcepub fn registry_path(&self) -> PathBuf
pub fn registry_path(&self) -> PathBuf
Return the path to the project registry index file.
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more