// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ // ┃ Copyright: (c) 2023, Mike 'PhiSyX' S. (https://github.com/PhiSyX) ┃ // ┃ SPDX-License-Identifier: MPL-2.0 ┃ // ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃ // ┃ ┃ // ┃ This Source Code Form is subject to the terms of the Mozilla Public ┃ // ┃ License, v. 2.0. If a copy of the MPL was not distributed with this ┃ // ┃ file, You can obtain one at https://mozilla.org/MPL/2.0/. ┃ // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ // --------- // // Structure // // --------- // #[derive(Debug)] #[derive(Clone)] #[derive(serde::Deserialize)] pub struct ApplicationEnv { pub database_url: String, pub app_secret_key: String, } // -------------- // // Implémentation // -> Interface // -------------- // impl lexa_framework::ApplicationEnvInterface for ApplicationEnv { fn setup( application_settings: &lexa_framework::ApplicationSettings, ) -> Result where Self: Sized, { let env_filepath = application_settings.root_dir.join(".env"); // EXAMPLE: // let env_filepath = match application_settings.process_env_mode { // | EnvProcessMode::LOCAL => ".env.local", // | EnvProcessMode::DEVELOPMENT => ".env.development", // | EnvProcessMode::PRODUCTION => ".env", // | EnvProcessMode::TEST => ".env.test", // }; Self::fetch_from_file(env_filepath) } }