Skip to content

Commit

Permalink
Use CARGO_PKG_VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
logankaser committed Feb 17, 2024
1 parent 21416e7 commit aec0467
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 2 additions & 4 deletions src/cli/interface.rs
Original file line number Diff line number Diff line change
@@ -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 <mufeed@lyminal.space>")
.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")
Expand Down
2 changes: 0 additions & 2 deletions src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
6 changes: 3 additions & 3 deletions src/core/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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.
//
Expand Down

0 comments on commit aec0467

Please sign in to comment.