ayun_environment/
instance.rsuse crate::Environment;
use ayun_core::{
errors::ContainerError,
traits::{ErrorTrait, InstanceTrait},
Container, Error, Result,
};
impl InstanceTrait for Environment {
fn register(_: &Container) -> Result<Self, ContainerError> {
let environment = match Self::try_from_args() {
Ok(env) => env,
Err(_) => Self::try_from_assertion().map_err(Error::wrap)?,
};
#[cfg(feature = "color-eyre")]
if !environment.production() {
color_eyre::install().expect("Failed to install color eyre");
}
Ok(environment)
}
}