Early stage Consul http api support

This commit is contained in:
Ara Sadoyan
2025-04-02 18:58:46 +02:00
parent cbbf45092b
commit 23dae51e22
13 changed files with 536 additions and 74 deletions

View File

@@ -1,3 +1,4 @@
use crate::utils::consul;
use crate::utils::filewatch;
use crate::utils::tools::*;
use crate::web::webserver;
@@ -11,6 +12,10 @@ pub struct APIUpstreamProvider {
pub address: String,
}
pub struct ConsulProvider {
pub path: String,
}
#[async_trait]
pub trait Discovery {
async fn start(&self, tx: Sender<(UpstreamsDashMap, Headers)>);
@@ -29,3 +34,10 @@ impl Discovery for FromFileProvider {
tokio::spawn(filewatch::start(self.path.clone(), tx.clone()));
}
}
#[async_trait]
impl Discovery for ConsulProvider {
async fn start(&self, tx: Sender<(UpstreamsDashMap, Headers)>) {
tokio::spawn(consul::start(self.path.clone(), tx.clone()));
}
}