pub struct HttpServerConfig {
pub addr: String,
pub port: u16,
pub uri: String,
pub url: String,
}Expand description
Basic configuration for an HTTP server.
Fields§
§addr: StringHost address, may be set by the HOST environment variable,
requests will be limited to the address passed. Setting
it to “0” means requests can be received from anywhere.
port: u16Host port, may be set by the PORT environment variable
uri: StringAPI URI (e.g. “/api”), may be set by the APP_URI environment variable
url: StringFinal URL parsed: “http://{addr}:{port}/{uri}”
Implementations§
Source§impl HttpServerConfig
impl HttpServerConfig
Sourcepub fn init_for(
default_host: &str,
default_port: u16,
) -> Result<HttpServerConfig>
pub fn init_for( default_host: &str, default_port: u16, ) -> Result<HttpServerConfig>
Initialize the configuration with the env variables HOST
(otherwise default_host) and PORT (otherwise use default_port),
and the env variable APP_URI is used to se the uri, otherwise
defaulted to empty string.
Trait Implementations§
Source§impl Clone for HttpServerConfig
impl Clone for HttpServerConfig
Source§fn clone(&self) -> HttpServerConfig
fn clone(&self) -> HttpServerConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpServerConfig
impl Debug for HttpServerConfig
Source§impl ToString for HttpServerConfig
impl ToString for HttpServerConfig
Auto Trait Implementations§
impl Freeze for HttpServerConfig
impl RefUnwindSafe for HttpServerConfig
impl Send for HttpServerConfig
impl Sync for HttpServerConfig
impl Unpin for HttpServerConfig
impl UnwindSafe for HttpServerConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more