v0.2.5-pre.010.fix.001
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-config-lib/src/management.rs
|
||||
// version: 5
|
||||
// version: 6
|
||||
|
||||
/// Raw source of one registered Config document read for explicit management/correction.
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
@@ -727,7 +727,7 @@ impl ConfigManagement {
|
||||
/// Authentication/authorization of the human user belongs to the calling application. Calling this method is the explicit Config boundary that opts into
|
||||
/// real-value access; the returned value must never be logged.
|
||||
pub fn reveal_effective_environment_value(&self, variable_name: &str) -> ksp_core_lib::Result<std::option::Option<String>> {
|
||||
let validation = crate::environment::validate_supported_variable_name(variable_name);
|
||||
let validation = crate::validate_supported_variable_name(variable_name);
|
||||
if let std::result::Result::Err(error) = validation {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
@@ -744,7 +744,7 @@ impl ConfigManagement {
|
||||
|
||||
/// Explicitly reveals the real persisted `.env` value for management display/editing.
|
||||
pub fn reveal_dotenv_value(&self, variable_name: &str) -> ksp_core_lib::Result<std::option::Option<String>> {
|
||||
let validation = crate::environment::validate_supported_variable_name(variable_name);
|
||||
let validation = crate::validate_supported_variable_name(variable_name);
|
||||
if let std::result::Result::Err(error) = validation {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
@@ -758,7 +758,7 @@ impl ConfigManagement {
|
||||
|
||||
/// Creates or updates one supported KSP/KSPB `.env` entry atomically without mutating the inherited process environment.
|
||||
pub fn set_dotenv_value(&self, variable_name: &str, value: &str) -> ksp_core_lib::Result<ConfigEnvironmentChangeReport> {
|
||||
let validation = crate::environment::validate_supported_variable_name(variable_name);
|
||||
let validation = crate::validate_supported_variable_name(variable_name);
|
||||
if let std::result::Result::Err(error) = validation {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
@@ -781,7 +781,7 @@ impl ConfigManagement {
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
if candidate != content {
|
||||
let write = crate::persistence::atomic_write_private(self.dotenv_path.as_path(), candidate.as_bytes());
|
||||
let write = crate::atomic_write_private(self.dotenv_path.as_path(), candidate.as_bytes());
|
||||
match write {
|
||||
std::result::Result::Ok(()) => {},
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
@@ -797,7 +797,7 @@ impl ConfigManagement {
|
||||
|
||||
/// Removes one supported KSP/KSPB `.env` entry atomically without mutating the inherited process environment.
|
||||
pub fn remove_dotenv_value(&self, variable_name: &str) -> ksp_core_lib::Result<ConfigEnvironmentChangeReport> {
|
||||
let validation = crate::environment::validate_supported_variable_name(variable_name);
|
||||
let validation = crate::validate_supported_variable_name(variable_name);
|
||||
if let std::result::Result::Err(error) = validation {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
@@ -820,7 +820,7 @@ impl ConfigManagement {
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
if candidate != content {
|
||||
let write = crate::persistence::atomic_write_private(self.dotenv_path.as_path(), candidate.as_bytes());
|
||||
let write = crate::atomic_write_private(self.dotenv_path.as_path(), candidate.as_bytes());
|
||||
match write {
|
||||
std::result::Result::Ok(()) => {},
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
@@ -838,6 +838,7 @@ impl ConfigManagement {
|
||||
return crate::ConfigEnvironment::load_from_dotenv_path(self.dotenv_path.as_path());
|
||||
}
|
||||
|
||||
/// Executes the crate-internal with dotenv path operation for `ConfigManagement`.
|
||||
#[cfg(test)]
|
||||
pub(crate) fn with_dotenv_path(engine: crate::ConfigDocumentEngine, dotenv_path: std::path::PathBuf) -> Self {
|
||||
return Self { engine, dotenv_path };
|
||||
@@ -1030,7 +1031,7 @@ fn persist_document_source(file_id: &crate::ConfigFileId, path: &std::path::Path
|
||||
if existing.as_slice() == source {
|
||||
return std::result::Result::Ok(ConfigDocumentChangeReport { source_changed: false, reload_required: false });
|
||||
}
|
||||
let write = crate::persistence::atomic_write(path, source);
|
||||
let write = crate::atomic_write(path, source);
|
||||
if let std::result::Result::Err(error) = write {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user