From 29733272e36438f1f2e083514ae83c49dcd46b26 Mon Sep 17 00:00:00 2001 From: Christoph Brandau Date: Thu, 23 Jul 2026 21:42:52 +0200 Subject: [PATCH] rust impl --- Cargo.lock | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 3 ++ src/main.rs | 17 ++++++++++- 3 files changed, 101 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 84b84cc..1cd2809 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,88 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + [[package]] name = "immich-extern-to-album" version = "0.1.0" +dependencies = [ + "dotenvy", + "log", + "serde", +] + +[[package]] +name = "log" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "syn" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" diff --git a/Cargo.toml b/Cargo.toml index a6f9340..2729b31 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,3 +4,6 @@ version = "0.1.0" edition = "2024" [dependencies] +dotenvy = "0.15.7" +log = "0.4.33" +serde = { version = "1.0.228", features = ["derive"] } diff --git a/src/main.rs b/src/main.rs index e7a11a9..cb205ad 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,18 @@ +use std::env; +struct AppState { + immich_url: String, + immich_api_key: String, + libary_id: String, + external_root: String, +} + fn main() { - println!("Hello, world!"); + let app_state = AppState { + immich_url: env::var("IMMICH_URL").unwrap_or_else(|_| "".to_string()), + immich_api_key: env::var("IMMICH_API_KEY").unwrap_or_else(|_| "".to_string()), + libary_id: env::var("IMMICH_LIBRARY_ID").unwrap_or_else(|_| "".to_string()), + external_root: env + ::var("EXTERNAL_ROOT") + .unwrap_or_else(|_| "/mnt/nextcloud-photos".to_string()), + }; }