pub struct Config {
pub activation: ActivationMode,
pub remote: Option<RemoteConfig>,
pub local: LocalConfig,
pub limits: Limits,
pub audit: AuditConfig,
pub guard: GuardConfig,
pub approval: ApprovalConfig,
}Fields§
§activation: ActivationModeWhen the global config alone should make a session remote.
remote: Option<RemoteConfig>Required everywhere except in the global config, which needs it only
for activation = "always".
local: LocalConfig§limits: Limits§audit: AuditConfig§guard: GuardConfig§approval: ApprovalConfigImplementations§
Source§impl Config
impl Config
pub fn example() -> &'static str
Sourcepub fn load(explicit: Option<&Path>) -> Result<(Self, PathBuf)>
pub fn load(explicit: Option<&Path>) -> Result<(Self, PathBuf)>
Load following the resolution order in the module docs, with the project file looked for in the process’s working directory.
Sourcepub fn load_in(cwd: Option<&Path>, explicit: Option<&Path>) -> Result<Loaded>
pub fn load_in(cwd: Option<&Path>, explicit: Option<&Path>) -> Result<Loaded>
Load following the resolution order, with the project file looked
for in cwd (default: the process’s working directory).
Sourcepub fn load_global() -> Result<Option<Self>>
pub fn load_global() -> Result<Option<Self>>
The global config, if there is one. It is the floor a project file is measured against and the source of the user’s own deny lists, so one that exists but does not load is an error: falling back to the defaults would quietly drop both.
Sourcepub fn parse_project(
text: &str,
base: Option<&Path>,
baseline: Option<&Config>,
) -> Result<(Self, Vec<String>)>
pub fn parse_project( text: &str, base: Option<&Path>, baseline: Option<&Config>, ) -> Result<(Self, Vec<String>)>
Parse a project file living in base, measured against baseline
(the global config, if there is one): settings that would loosen it
are dropped, and each drop is described in the returned notices.
Sourcepub fn parse(text: &str) -> Result<Self>
pub fn parse(text: &str) -> Result<Self>
Parse the global config, which belongs to no directory:
allowed_dirs entries must be absolute or ~/..., and [remote]
is needed only for activation = "always".
Sourcepub fn parse_at(text: &str, base: Option<&Path>) -> Result<Self>
pub fn parse_at(text: &str, base: Option<&Path>) -> Result<Self>
Parse a config file that lives in base; relative allowed_dirs
entries (".", "assets") are resolved against it. With base
None this is the global config (see Config::parse).