Причёсинг
This commit is contained in:
28
src/config.rs
Normal file
28
src/config.rs
Normal 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")?,
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user