use crate::rubase::rudto::cfgdto::{dbdto, etcdto, redisdto, softdto, webdto};
use crate::rubase:: BaseEntity ;
use serde::{Deserialize, Serialize};
use crate::rubase::getself::GetSelf;
use crate::rubase::rudto::cfgdto::etcdto::EtcdDto;
use crate::rubase::rudto::cfgdto::webdto::WebDto;
use crate::rubase::rudto::{DataSource, Gorm, RedisDto};
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
pub struct CfgDto {
pub software: softdto::SoftDto,
pub web: WebDto,
pub gorm: Gorm,
pub datasource: DataSource,
pub redis: RedisDto,
etcd: EtcdDto,
}
impl BaseEntity for CfgDto {}
impl GetSelf for CfgDto {}
impl CfgDto {
pub fn new() -> CfgDto {
Self {
redis: redisdto::RedisDto::default(),
software: softdto::SoftDto::default(),
gorm: dbdto::Gorm::new(),
datasource: dbdto::DataSource::new(),
web: webdto::WebDto::new(),
etcd: etcdto::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();
}
}