pub struct Config {
pub agent_email: Option<String>,
pub observability: Option<ObservabilityConfig>,
pub is_signed: bool,
pub raw_json: Option<Value>,
/* private fields */
}Fields§
§agent_email: Option<String>Cached @hai.ai email address for this agent.
observability: Option<ObservabilityConfig>§is_signed: boolWhether this config was loaded from a signed JACS document.
raw_json: Option<Value>Raw JSON value from disk, retained for signature verification.
Implementations§
Source§impl Config
impl Config
pub fn jacs_use_security(&self) -> &Option<String>
pub fn jacs_data_directory(&self) -> &Option<String>
pub fn jacs_key_directory(&self) -> &Option<String>
pub fn jacs_agent_private_key_filename(&self) -> &Option<String>
pub fn jacs_agent_public_key_filename(&self) -> &Option<String>
pub fn jacs_agent_key_algorithm(&self) -> &Option<String>
pub fn jacs_agent_id_and_version(&self) -> &Option<String>
pub fn jacs_default_storage(&self) -> &Option<String>
pub fn jacs_agent_domain(&self) -> &Option<String>
pub fn jacs_dns_validate(&self) -> &Option<bool>
pub fn jacs_dns_strict(&self) -> &Option<bool>
pub fn jacs_dns_required(&self) -> &Option<bool>
Sourcepub fn agent_email(&self) -> &Option<String>
pub fn agent_email(&self) -> &Option<String>
Cached @hai.ai email address for this agent.
Sourcepub fn jacs_keychain_backend(&self) -> &Option<String>
pub fn jacs_keychain_backend(&self) -> &Option<String>
OS keychain backend: “auto”, “macos-keychain”, “linux-secret-service”, or “disabled”.
pub fn jacs_database_url(&self) -> &Option<String>
Source§impl Config
impl Config
Sourcepub fn builder() -> ConfigBuilder
pub fn builder() -> ConfigBuilder
Sourcepub fn new(
jacs_use_security: Option<String>,
jacs_data_directory: Option<String>,
jacs_key_directory: Option<String>,
jacs_agent_private_key_filename: Option<String>,
jacs_agent_public_key_filename: Option<String>,
jacs_agent_key_algorithm: Option<String>,
jacs_private_key_password: Option<String>,
jacs_agent_id_and_version: Option<String>,
jacs_default_storage: Option<String>,
) -> Config
pub fn new( jacs_use_security: Option<String>, jacs_data_directory: Option<String>, jacs_key_directory: Option<String>, jacs_agent_private_key_filename: Option<String>, jacs_agent_public_key_filename: Option<String>, jacs_agent_key_algorithm: Option<String>, jacs_private_key_password: Option<String>, jacs_agent_id_and_version: Option<String>, jacs_default_storage: Option<String>, ) -> Config
Create a new Config.
§Arguments
jacs_private_key_password- DEPRECATED: This parameter is ignored. Passwords should be set via the JACS_PRIVATE_KEY_PASSWORD environment variable only.
pub fn get_key_algorithm(&self) -> Result<String, JacsError>
Sourcepub fn set_key_algorithm(&mut self, algorithm: String) -> Result<(), JacsError>
pub fn set_key_algorithm(&mut self, algorithm: String) -> Result<(), JacsError>
Set the key algorithm in the in-memory config.
Used during cross-algorithm key rotation to update the config’s algorithm field after new keys have been generated with the overridden algorithm.
Returns an error if the algorithm is not one of the supported values:
RSA-PSS, ring-Ed25519, pq2025.
Sourcepub fn config_dir(&self) -> Option<&Path>
pub fn config_dir(&self) -> Option<&Path>
Returns the directory containing the config file, if set.
This is set automatically by Config::from_file() to the parent directory
of the config file path. It is used by load_by_config to correctly
calculate storage_root without requiring the caller to pass the original
path or set environment variables as a side-channel.
Sourcepub fn set_config_dir(&mut self, dir: Option<PathBuf>)
pub fn set_config_dir(&mut self, dir: Option<PathBuf>)
Sets the config directory explicitly.
Normally set automatically by Config::from_file(). Use this when
constructing a Config programmatically and you need load_by_config
to resolve storage paths relative to a specific directory.
Sourcepub fn merge(&mut self, other: Config)
pub fn merge(&mut self, other: Config)
Merge another config into this one.
Values from other will override values in self if they are Some.
Sourcepub fn apply_env_overrides(&mut self)
pub fn apply_env_overrides(&mut self)
Apply environment variable overrides to this config. Environment variables always take precedence (12-Factor compliance).
This method reads from the following environment variables:
- JACS_USE_SECURITY
- JACS_DATA_DIRECTORY
- JACS_KEY_DIRECTORY
- JACS_AGENT_PRIVATE_KEY_FILENAME
- JACS_AGENT_PUBLIC_KEY_FILENAME
- JACS_AGENT_KEY_ALGORITHM
- JACS_AGENT_ID_AND_VERSION
- JACS_DEFAULT_STORAGE
- JACS_AGENT_DOMAIN
- JACS_DNS_VALIDATE
- JACS_DNS_STRICT
- JACS_DNS_REQUIRED
Note: JACS_PRIVATE_KEY_PASSWORD is intentionally NOT loaded into config. It should be read directly from environment when needed for security.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a Config with only hardcoded defaults (no env var lookups). This is useful for testing or when you want explicit control.
Sourcepub fn from_file(path: &str) -> Result<Config, JacsError>
pub fn from_file(path: &str) -> Result<Config, JacsError>
Load config from a JSON file without applying environment overrides.
This is the recommended way to load a config file. For 12-Factor compliance,
call config.apply_env_overrides() after loading, then Agent::from_config(config, password).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.