changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / rust/lib/krypt/src/lib.rs

changeset 698: 96958d3eb5b0
parent: 3d78bed56188
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 //! lib.rs --- Krypt Key Management Library
2 pub mod ks;
3 pub mod ss;
4 
5 pub use keyutils;
6 
7 use obj::{AuthConfig, Configure, DatabaseConfig, Objective, Result};
8 use serde::{Deserialize, Serialize};
9 use std::{fs, path::PathBuf};
10 
11 #[cfg(test)]
12 mod tests;
13 
14 #[derive(Serialize, Deserialize, Hash, Debug, Clone, Default)]
15 pub struct KryptConfig {
16  auth: AuthConfig,
17  db: DatabaseConfig,
18 }
19 
20 impl KryptConfig {
21  pub fn load_file(path: PathBuf) -> Result<KryptConfig> {
22  match fs::read_to_string(path) {
23  Ok(cfg) => KryptConfig::from_json_str(&cfg),
24  Err(e) => Err(e.into()),
25  }
26  }
27 }
28 
29 impl Objective for KryptConfig {}
30 impl Configure for KryptConfig {}