1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- use serde::Deserialize;
- use toml::Value;
- use crate::cfg::boot::BootConfigDef;
- #[derive(Deserialize, Clone)]
- pub struct EtcConfigDef{
- pub sys: SysCfg,
- pub env: toml::map::Map<String, Value>,
- pub boot_default: BootConfigDef,
- pub secure: SecureCfg,
- }
- impl EtcConfigDef {
- pub fn default() -> EtcConfigDef {
- EtcConfigDef{
- sys: SysCfg {
- sys_loader: "/nagae/elip4ng/bin/chen".to_string(),
- service_mgr: "/nagae/elip4ng/bin/ran".to_string(),
- shell_spawner: "/nagae/elip4ng/bin/reimu".to_string(),
- svc_mgr_exit_restart_limit: 10,
- svc_mgr_exit_restart_delay_secs: 1,
- },
- env: toml::map::Map::new(),
- boot_default: BootConfigDef::default(),
- secure: SecureCfg{
- bcrypt_password: "$2a$10$9Nk9um4osOsdDPw.NjgBx.0qbQ/5H/qLXplaNjBeKKj6N13.PE3YK".to_string(),
- },
- }
- }
- pub fn get_boot_default_clone(&self) -> BootConfigDef{
- self.boot_default.clone()
- }
- }
- #[derive(Deserialize, Clone)]
- pub struct SecureCfg {
- pub bcrypt_password: String,
- }
- #[derive(Deserialize, Clone)]
- pub struct SysCfg {
- pub sys_loader: String,
- pub service_mgr: String,
- pub shell_spawner: String,
- pub svc_mgr_exit_restart_limit: u64,
- pub svc_mgr_exit_restart_delay_secs: u64,
- }
- #[derive(Deserialize, Clone)]
- pub struct TeletypeCfg {
- pub baudrate: u32,
- pub device: String,
- pub getty: String,
- pub shell: String,
- }
|