pub struct AnvilConfigBuilder { /* private fields */ }Expand description
Builder for AnvilConfig.
Obtained via AnvilConfig::builder.
Implementations§
Source§impl AnvilConfigBuilder
impl AnvilConfigBuilder
Sourcepub fn username(self, username: impl Into<String>) -> Self
pub fn username(self, username: impl Into<String>) -> Self
Override the remote username (default: "git", FR-13).
Sourcepub fn add_identity_file(self, path: impl Into<PathBuf>) -> Self
pub fn add_identity_file(self, path: impl Into<PathBuf>) -> Self
Append path to the ordered identity-file list (FR-9).
Use this to add CLI-supplied keys; ssh_config-supplied keys flow
in through Self::apply_ssh_config. Both can coexist; auth
tries them in the order they were added.
Sourcepub fn identity_files(self, paths: Vec<PathBuf>) -> Self
pub fn identity_files(self, paths: Vec<PathBuf>) -> Self
Replace the entire identity-file list with paths. Existing
entries are discarded.
Sourcepub fn identity_file(self, path: impl Into<PathBuf>) -> Self
👎Deprecated since 0.3.0: use add_identity_file or identity_files for the multi-key API
pub fn identity_file(self, path: impl Into<PathBuf>) -> Self
use add_identity_file or identity_files for the multi-key API
Set a single identity-file path, replacing any existing entries.
0.2.x compatibility shim. New code should use
Self::add_identity_file (additive) or Self::identity_files
(replace-all) for clarity.
Sourcepub fn cert_file(self, path: impl Into<PathBuf>) -> Self
pub fn cert_file(self, path: impl Into<PathBuf>) -> Self
Set an OpenSSH certificate path (FR-12).
Sourcepub fn strict_host_key_checking(self, policy: StrictHostKeyChecking) -> Self
pub fn strict_host_key_checking(self, policy: StrictHostKeyChecking) -> Self
Set the host-key verification policy (FR-8).
Sourcepub fn skip_host_check(self, skip: bool) -> Self
👎Deprecated since 0.3.0: use strict_host_key_checking(StrictHostKeyChecking::No) for clarity
pub fn skip_host_check(self, skip: bool) -> Self
use strict_host_key_checking(StrictHostKeyChecking::No) for clarity
Disable host-key verification. Use only for emergencies (FR-8).
true maps to StrictHostKeyChecking::No; false to
StrictHostKeyChecking::Yes. Lossless from the 0.2.x boolean
shape (which only encoded those two states).
Sourcepub fn inactivity_timeout(self, timeout: Duration) -> Self
pub fn inactivity_timeout(self, timeout: Duration) -> Self
Override the session inactivity timeout (FR-5).
Sourcepub fn custom_known_hosts(self, path: impl Into<PathBuf>) -> Self
pub fn custom_known_hosts(self, path: impl Into<PathBuf>) -> Self
Path to a custom known_hosts-style file for self-hosted instances
(FR-7).
Sourcepub fn fallback(self, fallback: Option<(String, u16)>) -> Self
pub fn fallback(self, fallback: Option<(String, u16)>) -> Self
Override the fallback host/port. Pass None to disable fallback.
Sourcepub fn apply_ssh_config(self, resolved: &ResolvedSshConfig) -> Self
pub fn apply_ssh_config(self, resolved: &ResolvedSshConfig) -> Self
Layer values from a ResolvedSshConfig into this builder.
Provides ssh_config-derived defaults that subsequent builder calls can still override (call this before CLI-derived overrides if you want CLI to win). The following mappings are applied:
ssh_config directive | Builder field |
|---|---|
HostName | host (overridden) |
Port | port (overridden) |
User | username (overridden) |
IdentityFile (multi) | identity_files (extended) |
StrictHostKeyChecking | strict_host_key_checking (overridden) |
UserKnownHostsFile (first) | custom_known_hosts (filled if None) |
Algorithm directives (HostKeyAlgorithms, KexAlgorithms,
Ciphers, MACs) and ConnectTimeout / ConnectionAttempts are
not yet plumbed through to the session builder; they are recorded
in ResolvedSshConfig for gitway config show but consumption
is deferred to M17 / M18.
Sourcepub fn build(self) -> AnvilConfig
pub fn build(self) -> AnvilConfig
Finalise and return the AnvilConfig.