()
| 13 | |
| 14 | impl Config { |
| 15 | pub fn load() -> Result<Self> { |
| 16 | let profile = if cfg!(debug_assertions) { |
| 17 | "development" |
| 18 | } else { |
| 19 | "production" |
| 20 | }; |
| 21 | |
| 22 | let filename = format!(".env.{profile}.local"); |
| 23 | if Path::new(&filename).exists() { |
| 24 | dotenv::from_filename(filename).ok(); |
| 25 | } |
| 26 | dotenv::dotenv().ok(); |
| 27 | Ok(envy::from_env::<Self>()?) |
| 28 | } |
| 29 | } |