mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 09:04:12 +02:00
add notify_push service
This commit is contained in:
parent
3cac4e4679
commit
93c20bc530
10 changed files with 224 additions and 45 deletions
|
|
@ -1,10 +1,13 @@
|
|||
mod ldap;
|
||||
mod objectstore;
|
||||
mod onlyoffice;
|
||||
mod push;
|
||||
|
||||
use crate::config::HazeConfig;
|
||||
use crate::service::ldap::{LDAPAdmin, LDAP};
|
||||
use crate::service::objectstore::ObjectStore;
|
||||
use crate::service::onlyoffice::OnlyOffice;
|
||||
use crate::service::push::NotifyPush;
|
||||
use bollard::models::ContainerState;
|
||||
use bollard::Docker;
|
||||
use color_eyre::{eyre::WrapErr, Result};
|
||||
|
|
@ -19,7 +22,13 @@ pub trait ServiceTrait {
|
|||
|
||||
fn env(&self) -> &[&str];
|
||||
|
||||
async fn spawn(&self, docker: &Docker, cloud_id: &str, network: &str) -> Result<String>;
|
||||
async fn spawn(
|
||||
&self,
|
||||
docker: &Docker,
|
||||
cloud_id: &str,
|
||||
network: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<String>;
|
||||
|
||||
async fn is_healthy(&self, docker: &Docker, cloud_id: &str) -> Result<bool> {
|
||||
let info = docker
|
||||
|
|
@ -36,11 +45,17 @@ pub trait ServiceTrait {
|
|||
|
||||
fn container_name(&self, cloud_id: &str) -> String;
|
||||
|
||||
async fn start_message(&self, docker: &Docker, cloud_id: &str) -> Result<Option<String>>;
|
||||
async fn start_message(&self, _docker: &Docker, _cloud_id: &str) -> Result<Option<String>> {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
fn apps(&self) -> &'static [&'static str];
|
||||
fn apps(&self) -> &'static [&'static str] {
|
||||
&[]
|
||||
}
|
||||
|
||||
async fn post_setup(&self, docker: &Docker, cloud_id: &str) -> Result<Vec<String>>;
|
||||
async fn post_setup(&self, _docker: &Docker, _cloud_id: &str) -> Result<Vec<String>> {
|
||||
Ok(Vec::new())
|
||||
}
|
||||
}
|
||||
|
||||
#[enum_dispatch]
|
||||
|
|
@ -50,6 +65,7 @@ pub enum Service {
|
|||
LDAP(LDAP),
|
||||
LDAPAdmin(LDAPAdmin),
|
||||
OnlyOffice(OnlyOffice),
|
||||
Push(NotifyPush),
|
||||
}
|
||||
|
||||
impl Service {
|
||||
|
|
@ -58,6 +74,7 @@ impl Service {
|
|||
"s3" => Some(&[Service::ObjectStore(ObjectStore::S3)]),
|
||||
"ldap" => Some(&[Service::LDAP(LDAP), Service::LDAPAdmin(LDAPAdmin)]),
|
||||
"onlyoffice" => Some(&[Service::OnlyOffice(OnlyOffice)]),
|
||||
"push" => Some(&[Service::Push(NotifyPush)]),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue