mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 09:04:12 +02:00
allow services and presets to set pre-install config options
This commit is contained in:
parent
90ffcc0a1c
commit
60e797545e
9 changed files with 137 additions and 7 deletions
|
|
@ -3,6 +3,7 @@ mod dav;
|
|||
mod imaginary;
|
||||
mod kaspersky;
|
||||
mod ldap;
|
||||
mod mail;
|
||||
mod objectstore;
|
||||
mod oc;
|
||||
mod office;
|
||||
|
|
@ -10,7 +11,6 @@ mod onlyoffice;
|
|||
mod push;
|
||||
mod sftp;
|
||||
mod smb;
|
||||
mod mail;
|
||||
|
||||
use crate::config::{HazeConfig, Preset};
|
||||
pub use crate::service::clam::{ClamIcap, ClamIcapTls};
|
||||
|
|
@ -18,6 +18,7 @@ use crate::service::dav::Dav;
|
|||
use crate::service::imaginary::Imaginary;
|
||||
use crate::service::kaspersky::{Kaspersky, KasperskyIcap};
|
||||
pub use crate::service::ldap::{Ldap, LdapAdmin};
|
||||
use crate::service::mail::Mail;
|
||||
pub use crate::service::objectstore::ObjectStore;
|
||||
use crate::service::oc::Oc;
|
||||
pub use crate::service::office::Office;
|
||||
|
|
@ -29,10 +30,11 @@ use bollard::models::ContainerState;
|
|||
use bollard::Docker;
|
||||
use enum_dispatch::enum_dispatch;
|
||||
use miette::{IntoDiagnostic, Report, Result, WrapErr};
|
||||
use std::collections::HashMap;
|
||||
use std::net::IpAddr;
|
||||
use std::time::Duration;
|
||||
use tokio::time::{sleep, timeout};
|
||||
use crate::service::mail::Mail;
|
||||
use toml::Value;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
#[enum_dispatch(Service)]
|
||||
|
|
@ -82,6 +84,15 @@ pub trait ServiceTrait {
|
|||
&[]
|
||||
}
|
||||
|
||||
fn config(
|
||||
&self,
|
||||
_docker: &Docker,
|
||||
_cloud_id: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<HashMap<String, Value>> {
|
||||
Ok(HashMap::default())
|
||||
}
|
||||
|
||||
async fn post_setup(
|
||||
&self,
|
||||
_docker: &Docker,
|
||||
|
|
@ -246,6 +257,17 @@ impl ServiceTrait for PresetService {
|
|||
self.0.as_str()
|
||||
}
|
||||
|
||||
fn config(
|
||||
&self,
|
||||
_docker: &Docker,
|
||||
_cloud_id: &str,
|
||||
config: &HazeConfig,
|
||||
) -> Result<HashMap<String, Value>> {
|
||||
let preset =
|
||||
get_preset(&config.preset, &self.0).ok_or_else(|| Report::msg("invalid preset"))?;
|
||||
Ok(preset.config.clone())
|
||||
}
|
||||
|
||||
async fn post_setup(
|
||||
&self,
|
||||
_docker: &Docker,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue