Compare commits
2 commits
754e1f21a1
...
fe6b05313f
Author | SHA1 | Date | |
---|---|---|---|
|
fe6b05313f | ||
|
e4ca052656 |
3 changed files with 64 additions and 1 deletions
53
Cargo.lock
generated
53
Cargo.lock
generated
|
@ -36,6 +36,12 @@ version = "0.2.16"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc"
|
||||
|
||||
[[package]]
|
||||
name = "askama"
|
||||
version = "0.12.1"
|
||||
|
@ -264,6 +270,46 @@ dependencies = [
|
|||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b230ab84b0ffdf890d5a10abdbc8b83ae1c4918275daea1ab8801f71536b2651"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"clap_lex",
|
||||
"unicase",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.52",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
|
||||
|
||||
[[package]]
|
||||
name = "const-oid"
|
||||
version = "0.9.6"
|
||||
|
@ -1126,6 +1172,7 @@ dependencies = [
|
|||
"askama_axum",
|
||||
"axum",
|
||||
"chrono",
|
||||
"clap",
|
||||
"dotenvy",
|
||||
"env_logger",
|
||||
"justerror",
|
||||
|
@ -1936,6 +1983,12 @@ version = "1.11.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
|
||||
|
||||
[[package]]
|
||||
name = "unicode_categories"
|
||||
version = "0.1.1"
|
||||
|
|
|
@ -8,6 +8,7 @@ askama = { version = "0.12", default-features = false, features = ["with-axum",
|
|||
askama_axum = { version = "0.4", default-features = false }
|
||||
axum = { version = "0.7", default-features = false, features = ["tokio", "http1", "form"] }
|
||||
chrono = { version = "0.4", default-features = false, features = ["now"] }
|
||||
clap = { version = "4", default-features = false, features = ["derive", "unicode", "help", "usage", "std"] }
|
||||
dotenvy = { version = "0.15", default-features = false }
|
||||
env_logger = { version = "0.11", default-features = false, features = ["humantime"] }
|
||||
justerror = { version = "1" }
|
||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -1,5 +1,6 @@
|
|||
use std::{
|
||||
env::VarError,
|
||||
ffi::OsString,
|
||||
io::Write,
|
||||
net::{Ipv4Addr, SocketAddr},
|
||||
};
|
||||
|
@ -8,6 +9,7 @@ use axum::{
|
|||
routing::{get, MethodRouter},
|
||||
Router,
|
||||
};
|
||||
use clap::Parser;
|
||||
use sqlx::sqlite::{SqliteConnectOptions, SqlitePool, SqlitePoolOptions};
|
||||
use tokio::net::TcpListener;
|
||||
use tower_http::services::ServeDir;
|
||||
|
@ -56,8 +58,15 @@ async fn main() {
|
|||
//-************************************************************************
|
||||
// li'l helpers
|
||||
//-************************************************************************
|
||||
#[derive(Debug, Parser)]
|
||||
struct Cli {
|
||||
#[clap(long, short)]
|
||||
pub env: OsString,
|
||||
}
|
||||
|
||||
fn init() {
|
||||
dotenvy::dotenv().expect("Could not read .env file.");
|
||||
let cli = Cli::parse();
|
||||
dotenvy::from_path_override(cli.env).expect("Could not read .env file.");
|
||||
env_logger::builder()
|
||||
.format(|buf, record| {
|
||||
let ts = buf.timestamp();
|
||||
|
|
Loading…
Reference in a new issue