use crate::rubase::BaseEntity;
use crate::rubase::get_self::GetSelf;
use crate::rubase::rudto::cfgdto::etcd_dto::EtcdDto;
use crate::rubase::rudto::cfgdto::web_dto::WebDto;
use crate::rubase::rudto::cfgdto::{DataSource, etcd_dto, gorm, redis_dto, soft_dto, web_dto};
use crate::rubase::rudto::{Gorm, RedisDto};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
pub struct CfgDto {
pub software: soft_dto::SoftDto,
pub web: WebDto,
pub gorm: Gorm,
pub datasource: DataSource,
pub redis: RedisDto,
pub etcd: EtcdDto,
}
impl BaseEntity for CfgDto {}
impl GetSelf for CfgDto {}
impl CfgDto {
pub fn new() -> CfgDto {
Self {
redis: redis_dto::RedisDto::default(),
software: soft_dto::SoftDto::default(),
gorm: gorm::Gorm::new(),
datasource: DataSource::new(),
web: web_dto::WebDto::new(),
etcd: etcd_dto::EtcdDto::new(),
}
}
pub fn parse_env_var(&mut self) {
self.software.parse_env_var();
self.web.parse_env_var();
self.gorm.parse_env_var();
self.datasource.parse_env_var();
self.redis.parse_env_var();
self.etcd.parse_env_var();
}
pub fn find_env(&self) -> String {
self.software.env.clone()
}
}