serve

gest serve: start the web dashboard server.

struct Command

source

pub struct Command

Start the web dashboard server.

Field Type Description
bind_address Option<IpAddr> Address to bind to (overrides [serve].bind_address).
debounce_ms Option<u64> File watcher debounce in milliseconds (overrides [serve].debounce_ms).
no_open bool Suppress automatic browser opening.
port Option<u16> Port to listen on (overrides [serve].port).

Implements FromArgMatches, Args, Debug.

Command::call

source

pub async fn call(&self, context: &AppContext) -> Result<(), Error>

Start the embedded web dashboard, binding to the resolved address and port.

Parameter Type Description
context &AppContext the application context: settings, store and current project
returns Result<(), Error> Ok(()) when the command succeeds, or the error that stopped it.

fn persist_csrf_key

source

fn persist_csrf_key(path: &Path, hex: &str) -> Result<(), Error>

Merge the generated csrf_signing_key into the existing [serve] table and rewrite the config file preserving other keys.

Parameter Type Description
path &Path the global config file, created with its parent directories when missing
hex &str the key, hex-encoded
returns Result<(), Error> Ok(()) once the file is written, or the I/O or TOML error.

fn resolve_csrf_key

source

fn resolve_csrf_key(configured: Option<&str>) -> Result<CsrfKey, Error>

Resolve the CSRF signing key, generating and persisting one if absent.

When the [serve].csrf_signing_key config value is missing or malformed, a fresh 32-byte HMAC key is generated and written to the global config file so subsequent boots reuse the same key. If the global config path cannot be resolved (e.g. because $HOME and $XDG_CONFIG_HOME are both unset) the key is still generated in-memory – outstanding cookies become invalid on the next restart, matching the semantics of an ephemeral key.

Parameter Type Description
configured Option<&str> the hex key from [serve].csrf_signing_key, if set
returns Result<CsrfKey, Error> The configured key when it parses, else a new one. It is always Ok: a failure to save the new key is only logged.

fn resolve_global_config_path

source

fn resolve_global_config_path() -> Result<PathBuf, Error>

Resolve the global config file path, honoring $GEST_CONFIG.

Parameter Type Description
returns Result<PathBuf, Error> $GEST_CONFIG when it is set, else gest/config.toml in the XDG config directory, or a config error when there is no such directory.