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
32
33
34
35
36
//! 注册中心配置

use crate::tina::{client::registry::RegistryClientConfigInfo, data::AppResult, server::application::AppConfig};

use super::UpdateableConfig;

/// 注册中心
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(crate = "serde")]
pub struct RegistryConfig {
    /// 地址(支持集群)
    pub address: Vec<String>,
    /// 注册的应用名称
    pub app_name: String,
    /// 应用所在的组
    pub group_name: Option<String>,
    /// 用户名
    pub username: Option<String>,
    /// 密码
    pub password: Option<String>,
    /// 命名空间
    pub namespace: Option<String>,
    /// 是否健康
    pub healthy: Option<bool>,
    /// 注册中心配置信息
    pub config: Option<Vec<RegistryClientConfigInfo>>,
}

/// 可应用的配置
#[async_trait]
impl UpdateableConfig for RegistryConfig {
    /// 应用更新
    async fn apply(&self, _application: &AppConfig) -> AppResult<()> {
        Ok(())
    }
}