This commit is contained in:
2021-05-02 13:53:48 +02:00
parent 25d5590ceb
commit ab0166c5ac
6 changed files with 42 additions and 4 deletions

View File

@@ -13,12 +13,11 @@ async fn main() -> std::io::Result<()> {
App::new()
.wrap(middleware::Compress::default())
.wrap(middleware::DefaultHeaders::default())
// .wrap(middleware::NormalizePath::default())
.configure(note::init)
.configure(client::init)
.default_service(web::resource("").route(web::get().to(client::fallback_fn)))
})
.bind("127.0.0.1:5000")?
.bind("0.0.0.0:5000")?
.run()
.await
}

View File

@@ -3,8 +3,11 @@ use memcache;
use crate::note::Note;
lazy_static! {
static ref CLIENT: memcache::Client =
memcache::connect("memcache://127.0.0.1:11211?timeout=10&tcp_nodelay=true").unwrap();
static ref CLIENT: memcache::Client = memcache::connect(format!(
"memcache://{}?timeout=10&tcp_nodelay=true",
std::env::var("MEMCACHE").unwrap_or("127.0.0.1:11211".to_string())
))
.unwrap();
}
pub fn set(id: &String, note: &Note) {