2020-02-14 12:20:17 +01:00
|
|
|
use std::str::FromStr;
|
|
|
|
use std::path::PathBuf;
|
2020-02-16 16:02:03 +01:00
|
|
|
use serde::{Serialize, Deserialize};
|
2020-02-14 12:20:17 +01:00
|
|
|
|
|
|
|
use crate::error::Result;
|
|
|
|
|
|
|
|
pub fn read() -> Result<Config> {
|
|
|
|
Ok(Config {
|
2020-02-16 16:02:03 +01:00
|
|
|
machinedb: PathBuf::from_str("/tmp/machines.db").unwrap(),
|
2020-02-14 12:20:17 +01:00
|
|
|
access: Access {
|
|
|
|
model: PathBuf::from_str("/tmp/model.conf").unwrap(),
|
|
|
|
policy: PathBuf::from_str("/tmp/policy.csv").unwrap(),
|
2020-02-16 16:02:03 +01:00
|
|
|
},
|
|
|
|
passdb: PathBuf::from_str("/tmp/passwd.db").unwrap(),
|
2020-02-14 12:20:17 +01:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-02-16 16:02:03 +01:00
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
2020-02-14 12:20:17 +01:00
|
|
|
pub struct Config {
|
2020-02-16 16:02:03 +01:00
|
|
|
pub(crate) access: Access,
|
|
|
|
pub machinedb: PathBuf,
|
|
|
|
pub passdb: PathBuf,
|
2020-02-14 12:20:17 +01:00
|
|
|
}
|
|
|
|
|
2020-02-16 16:02:03 +01:00
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
2020-02-14 12:20:17 +01:00
|
|
|
pub struct Access {
|
|
|
|
pub(crate) model: PathBuf,
|
|
|
|
pub(crate) policy: PathBuf
|
|
|
|
}
|