Skip to main content

AppConfig

Struct AppConfig 

Source
pub struct AppConfig {
    pub backend_type: String,
    pub verbose: bool,
    pub pass: PassBackendConfig,
    pub local: LocalBackendConfig,
    pub security: SecurityConfig,
    pub pin: PinConfig,
}
Expand description

Main application configuration Note: Cannot derive Clone/Debug because it has #[clap_serde] fields

Fields§

§backend_type: String

Storage backend type: pass, tpm (experimental), or local (for testing)

§verbose: bool

Enable verbose logging

§pass: PassBackendConfig

Pass backend configuration

§local: LocalBackendConfig

Local backend configuration

§security: SecurityConfig

Security hardening configuration

§pin: PinConfig

PIN configuration

Implementations§

Source§

impl AppConfig

Source

pub fn field_docs() -> &'static [(&'static str, &'static str)]

Get documentation for all fields Returns an array of (field_name, documentation) tuples

Source

pub fn struct_doc() -> &'static str

Get struct-level documentation

Source

pub fn to_toml_fields(&self) -> Vec<(&'static str, Option<String>)>

Get field values as TOML-formatted strings

Source§

impl AppConfig

Source

pub fn to_toml_with_comments(&self) -> String

Generate TOML configuration with comments extracted from doc comments

Source§

impl AppConfig

Source

pub fn config_file_path(args: &Args) -> Option<PathBuf>

The configuration file Self::load reads: --config/PASSLESS_CONFIG, else the default ~/.config/passless/config.toml, if it exists.

Source

pub fn load(args: &mut Args) -> Result<Self>

Load configuration with precedence: CLI > config file > defaults

Source

pub fn backend(&self) -> Result<BackendConfig>

Get the backend configuration based on the backend_type

Source

pub fn apply_security_hardening(&self) -> Result<(), Box<dyn Error>>

Apply security hardening measures

Source

pub fn security_config(&self) -> SecurityConfig

Get security configuration

Source

pub fn pin_config(&self) -> PinConfig

Get PIN configuration

Source

pub fn check_startup(&self) -> Result<()>

Everything the daemon checks of the configuration before it starts serving: Self::validate and the backend’s own validation (main.rs runs the same steps one by one, with its own log messages). Used by passless config check and passless doctor.

Source

pub fn validate(&self) -> Result<()>

Validate the configuration

Trait Implementations§

Source§

impl ClapSerde for AppConfig

Source§

type Opt = ClapSerdeOptionalAppConfig

The same struct of the parent but with optional fields.
Source§

fn update(&mut self, other: impl BorrowMut<Self::Opt>)

Merge in place from Opt struct. Read more
Source§

fn merge(self, other: impl BorrowMut<Self::Opt>) -> Self

Merge from Opts struct.
Source§

fn merge_clap(self) -> Self

Merge from clap to the object.
Source§

fn from_clap() -> Self

Create new object parsing from clap.
Source§

impl Debug for AppConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AppConfig

Source§

fn default() -> Self

Create default AppConfig

Source§

impl<'de> Deserialize<'de> for AppConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&mut <AppConfig as ClapSerde>::Opt> for AppConfig

Source§

fn from(data: &mut <Self as ClapSerde>::Opt) -> Self

Create new object from &mut Opt.

Source§

impl From<<AppConfig as ClapSerde>::Opt> for AppConfig

Source§

fn from(data: <Self as ClapSerde>::Opt) -> Self

Create new object from Opt.

Source§

impl Serialize for AppConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.