vertigo_cli/serve/
serve_opts.rs

1use clap::Args;
2
3use crate::commons::models::CommonOpts;
4use crate::commons::parse_key_val;
5
6#[derive(Args, Clone, Debug)]
7pub struct ServeOpts {
8    #[clap(flatten)]
9    pub inner: ServeOptsInner,
10    #[clap(flatten)]
11    pub common: CommonOpts,
12}
13
14#[derive(Args, Clone, Debug)]
15pub struct ServeOptsInner {
16    #[arg(long, default_value_t = {"127.0.0.1".into()})]
17    pub host: String,
18    #[arg(long, default_value_t = {4444})]
19    pub port: u16,
20
21    /// sets up proxy: `--proxy /path=http://domain.com/path`
22    #[arg(long, value_parser = parse_key_val::<String, String>)]
23    pub proxy: Vec<(String, String)>,
24
25    /// Define a mount point for the app in public url.
26    ///
27    /// (For example an nginx's location in which proxy_pass to the app was defined)
28    #[arg(long, default_value_t = {"/".to_string()})]
29    pub mount_point: String,
30
31    /// Setting the parameters `--env api=http://domain.com/api --env api2=http://domain.com/api2`
32    #[arg(long, value_parser = parse_key_val::<String, String>)]
33    pub env: Vec<(String, String)>,
34
35    /// Whether to add `<link rel="preload">` tag to `<head>` to make the browser load WASM earlier
36    #[arg(long, default_value_t = {false})]
37    pub wasm_preload: bool,
38
39    /// Disable hydration on page load (will re-create DOM instead of claiming existing nodes from SSR)
40    #[arg(long, default_value_t = {false})]
41    pub disable_hydration: bool,
42}