pub extra_config: Vec<PathBuf>,
}
-pub struct CidrString(pub String);
+pub struct Secret(pub String);
+impl Parseable for Secret {
+ #[throws(AE)]
+ fn parse(s: Option<&str>) -> Self {
+ let s = s.ok_or_else(|| anyhow!("value needed"))?;
+ if s.is_empty() { throw!(anyhow!("secret value cannot be empty")) }
+ Secret(s.into())
+ }
+ #[throws(AE)]
+ fn default() -> Self { Secret(default()) }
+}
+impl Debug for Secret {
+ #[throws(fmt::Error)]
+ fn fmt(&self, f: &mut fmt::Formatter) { write!(f, "Secret(***)")? }
+}
#[derive(hippotat_macros::ResolveConfig)]
pub struct InstanceConfig {
// Exceptional settings
#[special(special_server, SKL::ServerName)] pub server: ServerName,
- pub secret: String, //xxx newytpe
+ pub secret: Secret,
#[special(special_ipif, SKL::Ordinary)] pub ipif: String,
// Capped settings:
pub use std::collections::HashMap;
pub use std::cmp::{min, max};
pub use std::fs;
-pub use std::fmt::Debug;
+pub use std::fmt::{self, Debug};
pub use std::io::{self, ErrorKind, Read as _};
pub use std::mem;
pub use std::net::{IpAddr, Ipv4Addr};