Merge
This commit is contained in:
commit
2122227513
7 changed files with 220 additions and 184 deletions
|
|
@ -13,5 +13,6 @@ listenfd = "0.3" # To watch file modifications and automatically launch a build
|
|||
ron = "0.5" # Rust object notation, to load configuration files.
|
||||
itertools = "0.8"
|
||||
sqlite = "0.25"
|
||||
env_logger = "0.6"
|
||||
|
||||
common = { path = "../common" }
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
if ($args.Count -lt 1) {
|
||||
$scriptName = [Environment]::GetCommandLineArgs()[1]
|
||||
echo "Usage: $scriptName <destination>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
git pull
|
||||
cargo build --release
|
||||
|
||||
systemctl --user stop www-recipes.service
|
||||
|
||||
$destination=$args[0]
|
||||
|
||||
if (!(Test-Path -Path $destination)) {
|
||||
New-Item -ItemType directory -Path $destination
|
||||
}
|
||||
|
||||
Copy-Item target/release/recipes -Destination $destination
|
||||
|
||||
Copy-Item static -Destination $destination -Recurse -Force
|
||||
|
||||
# Do not overwrite the configuration.
|
||||
if (!(Test-Path -Path $destination/conf.ron)) {
|
||||
Copy-Item conf.ron -Destination $destination
|
||||
}
|
||||
|
||||
systemctl --user start www-recipes.service
|
||||
|
||||
|
|
@ -1 +1,3 @@
|
|||
pub static FILE_CONF: &str = "conf.ron";
|
||||
pub static FILE_CONF: &str = "conf.ron";
|
||||
pub static DB_DIRECTORY: &str = "data";
|
||||
pub static DB_FILENAME: &str = "recipes.sqlite";
|
||||
|
|
@ -1,16 +1,14 @@
|
|||
extern crate actix_web;
|
||||
extern crate listenfd;
|
||||
extern crate askama;
|
||||
|
||||
use listenfd::ListenFd;
|
||||
use actix_files as fs;
|
||||
use actix_web::{web, middleware, App, HttpServer, HttpResponse, Result, web::Query};
|
||||
use askama::Template;
|
||||
|
||||
use std::io::prelude::*;
|
||||
use std::{fs::File, env::args};
|
||||
|
||||
use actix_files as fs;
|
||||
use actix_web::{web, middleware, App, HttpServer, HttpResponse, Result, web::Query, middleware::Logger};
|
||||
|
||||
use askama::Template;
|
||||
use listenfd::ListenFd;
|
||||
use ron::de::from_reader;
|
||||
use serde::Deserialize;
|
||||
use std::{fs::File, env::args};
|
||||
use env_logger;
|
||||
|
||||
use itertools::Itertools;
|
||||
|
||||
|
|
@ -64,13 +62,17 @@ fn main() -> std::io::Result<()> {
|
|||
|
||||
let database_connection = db::create_or_update();
|
||||
|
||||
std::env::set_var("RUST_LOG", "actix_web=info");
|
||||
env_logger::init();
|
||||
|
||||
let mut listenfd = ListenFd::from_env();
|
||||
let mut server =
|
||||
HttpServer::new(
|
||||
|| {
|
||||
App::new()
|
||||
.wrap(middleware::Compress::default())
|
||||
.wrap(middleware::Logger::default())
|
||||
.wrap(Logger::default())
|
||||
.wrap(Logger::new("%a %{User-Agent}i"))
|
||||
.service(web::resource("/").to(main_page))
|
||||
.service(fs::Files::new("/static", "static").show_files_listing())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue