mirror of
https://github.com/sadoyan/aralez.git
synced 2026-04-30 23:08:40 +08:00
Early stage Consul http api support
This commit is contained in:
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user