refactor conf

This commit is contained in:
Marc Planard 2023-06-04 17:33:28 +02:00
parent 61ede78868
commit edba874ae7
6 changed files with 69 additions and 37 deletions

View file

@ -1,21 +1,31 @@
use config::Config;
use serde::Deserialize;
use serde::{Serialize,Deserialize};
use crate::errors::LJResult;
#[derive(Deserialize, Debug)]
pub enum DacFamily {
Helios,
Etherdream,
}
#[derive(Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug)]
pub struct Conf {
pub laser_id: u8,
pub debug: bool,
pub redis_url: String,
pub dac_family: DacFamily,
pub dac_id: Option<u8>,
pub dac_url: Option<String>,
pub dac: DacFamily
}
#[derive(Serialize, Deserialize, Debug)]
pub enum DacFamily {
#[serde(rename = "helios")]
Helios(HeliosConf),
#[serde(rename = "etherdream")]
Etherdream(EtherDreamConf),
}
#[derive(Serialize, Deserialize, Debug)]
pub struct HeliosConf {
pub id: u8
}
#[derive(Serialize, Deserialize, Debug)]
pub struct EtherDreamConf {
pub url: String
}
impl Conf {