diff options
author | Toby Vincent <tobyv13@gmail.com> | 2022-02-01 01:52:04 -0600 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2022-02-01 01:52:04 -0600 |
commit | 1a5a7eed4df2ee7aebdb752b78e7da78e5f15d28 (patch) | |
tree | d6a4575aad284735c1fbb8ceb98b4fe80798cfdc /zone_zfs/src/file_system.rs | |
parent | 493d909da8c6540b63ca2f461a9d2462715ebd0e (diff) |
fix: integrated figment with rocket
Co-authored-by: Neil Kollack <nkollack@gmail.com>
Diffstat (limited to 'zone_zfs/src/file_system.rs')
-rw-r--r-- | zone_zfs/src/file_system.rs | 42 |
1 files changed, 3 insertions, 39 deletions
diff --git a/zone_zfs/src/file_system.rs b/zone_zfs/src/file_system.rs index b73d2da..3b4cf8d 100644 --- a/zone_zfs/src/file_system.rs +++ b/zone_zfs/src/file_system.rs @@ -1,8 +1,6 @@ use anyhow::{anyhow, Context, Result}; -use figment::{Figment, Provider, providers::{Format, Toml}, Error, Metadata, Profile}; -use figment::value::{Map, Dict}; use zone_core::{Container, ContainerStatus}; -use serde::{Serialize, Deserialize}; + use std::{ ffi::{OsStr, OsString}, fmt::Display, @@ -10,43 +8,9 @@ use std::{ process::{Command, Output}, }; -use super::snapshot::Snapshot; - -#[derive(Debug, Deserialize, Serialize)] -pub struct ZFSConfig { - pub quota: String, -} - -impl Default for ZFSConfig { - fn default() -> Self { - ZFSConfig { - quota: "16G".to_string(), - } - } -} - -impl ZFSConfig { - pub fn from<T: Provider>(provider: T) -> Result<ZFSConfig, Error> { - Figment::from(provider).extract() - } +use crate::Config; - // Provide a default provider, a `Figment`. - pub fn figment() -> Figment { - Figment::from(ZFSConfig::default()).merge(Toml::file("/etc/zoned/Config.toml")) - } -} - -impl Provider for ZFSConfig { - fn metadata(&self) -> Metadata { - Metadata::named("File System Config") - } - - fn data(&self) -> Result<Map<Profile, Dict>, Error> { - figment::providers::Serialized::defaults(ZFSConfig::default()).data() - } - - //fn profile(&self) -> Option<Profile> {} -} +use super::snapshot::Snapshot; #[derive(Debug)] pub struct FileSystem { |