lxy 0.1.1

A convenient async http and RPC framework in Rust
Documentation
use serde::Deserialize;

use crate::config::Config;

#[derive(Debug, Deserialize, Clone)]
pub struct ServerConfig {
  #[serde(default = "default_host")]
  pub host: String,
  #[serde(default = "default_port")]
  pub port: u16,
}

fn default_host() -> String {
  "127.0.0.1".into()
}

fn default_port() -> u16 {
  8080
}

impl Default for ServerConfig {
  fn default() -> Self {
    Self {
      host: default_host(),
      port: default_port(),
    }
  }
}

impl Config for ServerConfig {
  fn name() -> &'static str {
    "server"
  }

  fn env_prefix() -> Option<&'static str> {
    Some("APP_SERVER_")
  }
}