Struct glory_core::config::GloryConfig
source · pub struct GloryConfig {
pub output_name: String,
pub site_root: String,
pub site_pkg_dir: String,
pub site_addr: SocketAddr,
pub reload_port: u32,
pub reload_external_port: Option<u32>,
pub reload_ws_protocol: ReloadWSProtocol,
pub not_found_path: String,
}Fields§
§output_name: StringThe name of the WASM and JS files generated by wasm-bindgen. Defaults to the crate name with underscores instead of dashes
site_root: StringThe path of the all the files generated by glory-cli. This defaults to ‘.’ for convenience when integrating with other tools.
site_pkg_dir: StringThe path of the WASM and JS files generated by wasm-bindgen from the root of your app
By default, wasm-bindgen puts them in pkg.
site_addr: SocketAddrProvides a way to control the address glory is served from.
Using an env variable here would allow you to run the same code in dev and prod
Defaults to 127.0.0.1:8000
reload_port: u32The port the Websocket watcher listens on. Should match the reload_port in glory-cli(if using).
Defaults to 8001
reload_external_port: Option<u32>The port the Websocket watcher listens on when on the client, e.g., when behind a reverse proxy. Defaults to match reload_port
reload_ws_protocol: ReloadWSProtocolThe protocol the Websocket watcher uses on the client: ws in most cases, wss when behind a reverse https proxy.
Defaults to ws
not_found_path: StringThe path of a custom 404 Not Found page to display when statically serving content, defaults to site_root/404.html
Implementations§
source§impl GloryConfig
impl GloryConfig
pub fn new() -> Self
sourcepub async fn load(
path: impl Into<Option<&str>>
) -> Result<Self, GloryConfigError>
pub async fn load( path: impl Into<Option<&str>> ) -> Result<Self, GloryConfigError>
Loads GloryConfig from a Cargo.toml with layered overrides. If an env var is specified, like GLORY_ENV,
it will override a setting in the file. It takes in an optional path to a Cargo.toml file. If None is provided,
you’ll need to set the options as environment variables or rely on the defaults. This is the preferred
approach for glory-cli. If Some(“./Cargo.toml”) is provided, Glory will read in the settings itself. This
option currently does not allow dashes in file or folder names, as all dashes become underscores
sourcepub async fn load_from_file<P: AsRef<Path>>(
path: P
) -> Result<Self, GloryConfigError>
pub async fn load_from_file<P: AsRef<Path>>( path: P ) -> Result<Self, GloryConfigError>
Loads GloryConfig from a Cargo.toml with layered overrides. Glory will read in the settings itself. This option currently does not allow dashes in file or folder names, as all dashes become underscores
sourcepub fn load_from_env() -> Result<Self, GloryConfigError>
pub fn load_from_env() -> Result<Self, GloryConfigError>
Loads GloryConfig from environment variables or rely on the defaults
sourcepub fn load_from_str(text: &str) -> Result<Self, GloryConfigError>
pub fn load_from_str(text: &str) -> Result<Self, GloryConfigError>
Loads GloryConfig from a Cargo.toml text content with layered overrides.
If an env var is specified, like GLORY_ENV, it will override a setting in the file.
Trait Implementations§
source§impl Clone for GloryConfig
impl Clone for GloryConfig
source§fn clone(&self) -> GloryConfig
fn clone(&self) -> GloryConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more