diff --git a/Cargo.toml b/Cargo.toml index 599bae2..a39fc9a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,14 @@ name = "geoffrey" version = "0.1.0" edition = "2018" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +authors = ["R Tyler Croy "] +description = "The freshest butler in Bel-air" [dependencies] +async-std = { version = "1", features = ["attributes", "tokio1"] } +dotenv = "*" +handlebars = { version = "4", features = ["dir_source"] } +log = "*" +pretty_env_logger = "0.3" +#sqlx = { version = "0.5", features = ["chrono", "json", "offline", "postgres", "uuid", "runtime-async-std-rustls"] } +tide = "*" diff --git a/projects.d/.gitignore b/projects.d/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/src/main.rs b/src/main.rs index e7a11a9..82d192e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,29 @@ -fn main() { - println!("Hello, world!"); + + +#[async_std::main] +async fn main() -> Result<(), std::io::Error> { + dotenv::dotenv().ok(); + pretty_env_logger::init(); + + #[cfg(debug_assertions)] + { + info!("Activating DEBUG mode configuration"); + } + + if let Some(fd) = std::env::var("LISTEN_FD") + .ok() + .and_then(|fd| fd.parse().ok()) + { + /* + * Allow the use of catflag for local development + * + */ + use std::net::TcpListener; + use std::os::unix::io::FromRawFd; + app.listen(unsafe { TcpListener::from_raw_fd(fd) }).await?; + } else { + app.listen("0.0.0.0:8000").await?; + } + + Ok(()) }