diff --git a/src/cli/interface.rs b/src/cli/interface.rs index 38a81f5..154fa65 100644 --- a/src/cli/interface.rs +++ b/src/cli/interface.rs @@ -1,16 +1,14 @@ use clap::{Arg, ArgMatches, Command}; -use crate::core::VERSION; - /// Prints an ASCII art banner to look cool! pub fn banner() { - eprintln!("{} {}\n", include_str!("banner"), VERSION) + eprintln!("{} {}\n", include_str!("banner"), env!("CARGO_PKG_VERSION")) } /// Command-line arguments pub fn args() -> ArgMatches { Command::new("binserve") - .version(VERSION) + .version(env!("CARGO_PKG_VERSION")) .author("Mufeed VH ") .about("A fast static web server with Automatic HTTPs, routing, templating, and security in a single binary you can setup with zero code.") .arg(Arg::new("command") diff --git a/src/core/mod.rs b/src/core/mod.rs index f2b0f36..6f7c6fd 100644 --- a/src/core/mod.rs +++ b/src/core/mod.rs @@ -6,5 +6,3 @@ pub(super) mod server; pub(super) mod templates; pub(super) mod tls; pub(super) mod watcher; - -pub static VERSION: &str = "0.2.1"; diff --git a/src/core/server.rs b/src/core/server.rs index 3859d65..081b291 100644 --- a/src/core/server.rs +++ b/src/core/server.rs @@ -18,7 +18,7 @@ use std::path::{Path, PathBuf}; use super::{ config::{BinserveConfig, CONFIG_STATE}, routes::{Type, ROUTEMAP}, - tls, VERSION, + tls, }; use crate::cli::messages::{push_message, Type as MsgType}; @@ -158,8 +158,8 @@ pub async fn run_server(config_state: BinserveConfig) -> std::io::Result<()> { let mut headers_middleware = middleware::DefaultHeaders::new(); // binserve server header - headers_middleware = - headers_middleware.add((SERVER, format!("binserve/{}", VERSION))); + headers_middleware = headers_middleware + .add((SERVER, format!("binserve/{}", env!("CARGO_PKG_VERSION")))); // Add the `Cache-Control` header if enabled in config. //