use cfg!
This commit is contained in:
parent
c1dbbfb904
commit
98bd83e7ec
2 changed files with 5 additions and 11 deletions
|
@ -4,7 +4,6 @@ use actix_web::{
|
||||||
web, App, HttpServer,
|
web, App, HttpServer,
|
||||||
};
|
};
|
||||||
use std::io::Result;
|
use std::io::Result;
|
||||||
use utils::misc::is_debug;
|
|
||||||
|
|
||||||
use crate::routes::{
|
use crate::routes::{
|
||||||
agreements, api_v1, blog, contact, contrib, cours, cv, gaming, index, memorial, not_found,
|
agreements, api_v1, blog, contact, contrib, cours, cv, gaming, index, memorial, not_found,
|
||||||
|
@ -22,7 +21,11 @@ async fn main() -> Result<()> {
|
||||||
let config = config::get_configuration("./config/config.toml");
|
let config = config::get_configuration("./config/config.toml");
|
||||||
|
|
||||||
let addr = (
|
let addr = (
|
||||||
if is_debug() { "127.0.0.1" } else { "0.0.0.0" },
|
if cfg!(debug_assertions) {
|
||||||
|
"127.0.0.1"
|
||||||
|
} else {
|
||||||
|
"0.0.0.0"
|
||||||
|
},
|
||||||
config.fc.port.unwrap(),
|
config.fc.port.unwrap(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -87,12 +87,3 @@ fn read_pdf(data: Vec<u8>) -> File {
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
pub fn is_debug() -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(debug_assertions))]
|
|
||||||
pub fn is_debug() -> bool {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue