-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathmod.rs
31 lines (23 loc) · 768 Bytes
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use std::sync::Arc;
use crate::app_state::AppState;
pub mod docker_source;
pub mod file_source;
pub mod source;
#[cfg(feature = "kubernetes")]
pub mod kubernetes_source;
pub fn get_sources(state: Arc<AppState>) -> Vec<Box<dyn source::Source>> {
let mut sources: Vec<Box<dyn source::Source>> = vec![];
if state.config.files.enabled {
sources.push(Box::new(file_source::FileSource::new(state.clone())));
}
if state.config.docker.enabled {
sources.push(Box::new(docker_source::DockerSource::new(state.clone())));
}
if state.config.kubernetes.enabled {
#[cfg(feature = "kubernetes")]
sources.push(Box::new(kubernetes_source::KubernetesSource::new(
state.clone(),
)));
}
sources
}