fabaccess-bffh/src/config.rs

30 lines
757 B
Rust
Raw Normal View History

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