Причёсинг

This commit is contained in:
2026-04-15 21:17:14 +03:00
parent 11fc697771
commit 9c73a8672e
7 changed files with 641 additions and 95 deletions

28
src/config.rs Normal file
View File

@@ -0,0 +1,28 @@
use anyhow::{Context, Result};
use dotenv::dotenv;
use std::env;
#[derive(Debug, Clone)]
pub struct Config {
pub nas_fqdn: String,
pub nas_user: String,
pub nas_pass: String,
pub nas_file: String,
pub nexrender_api_url: String,
pub output_folder: String,
}
impl Config {
pub fn from_env() -> Result<Self> {
dotenv().ok();
Ok(Self {
nas_fqdn: env::var("NAS_FQDN").context("NAS_FQDN not set")?,
nas_user: env::var("NAS_USER").context("NAS_USER not set")?,
nas_pass: env::var("NAS_PASS").context("NAS_PASS not set")?,
nas_file: env::var("NAS_FILE").context("NAS_FILE not set")?,
nexrender_api_url: env::var("NEXRENDER_API_URL").context("NEXRENDER_API_URL not set")?,
output_folder: env::var("OUTPUT_FOLDER").context("OUTPUT_FOLDER not set")?,
})
}
}