changed configuration hierarchie
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
use config::Config;
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::models::WatcherConfig;
|
||||
|
||||
impl WatcherConfig {
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
pub struct AppConfig {
|
||||
pub watcher: WatcherConfig,
|
||||
}
|
||||
|
||||
impl AppConfig {
|
||||
pub fn from_env() -> Result<Self, config::ConfigError> {
|
||||
// Load .env file (works in both Docker and local development)
|
||||
dotenvy::dotenv().ok();
|
||||
|
||||
let cfg = config::Config::builder()
|
||||
let cfg = Config::builder()
|
||||
.add_source(config::Environment::with_prefix("WATCHER").separator("_"))
|
||||
.build()?;
|
||||
|
||||
|
Reference in New Issue
Block a user