load_env_file

Function load_env_file 

Source
pub fn load_env_file() -> Result<PathBuf, Error>
Expand description

Load environment variables from app.env file.

Call this early in your application startup to ensure environment variables are loaded before any configuration functions are called.

This function is automatically called by from_env, but you can call it explicitly if you need to load the file earlier or check for errors.

§Returns

  • Ok(PathBuf) if the file was found and loaded successfully
  • Err(dotenvy::Error) if the file was not found or couldn’t be parsed

§Example

use html2pdf_api::config::env::load_env_file;

// Load at application startup
match load_env_file() {
    Ok(path) => println!("Loaded environment from: {:?}", path),
    Err(e) => println!("No app.env file found: {}", e),
}