mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-07 18:07:47 +08:00
feat(gateway): configure cyber policy failover
This commit is contained in:
@@ -1742,6 +1742,7 @@ pub fn admin_system_config_default_value(key: &str) -> Option<serde_json::Value>
|
||||
"email_suffix_mode" => Some(json!("none")),
|
||||
"email_suffix_list" => Some(json!([])),
|
||||
"enable_format_conversion" => Some(json!(false)),
|
||||
"cyber_continue_failover" => Some(json!(false)),
|
||||
"enable_model_directives" => Some(json!(false)),
|
||||
"model_directives" => Some(aether_ai_formats::default_model_directives_config()),
|
||||
"keep_priority_on_conversion" => Some(json!(false)),
|
||||
@@ -2153,7 +2154,8 @@ pub fn parse_admin_system_config_update(
|
||||
}
|
||||
|
||||
match normalized_key.as_str() {
|
||||
"module.important_notification.enabled"
|
||||
"cyber_continue_failover"
|
||||
| "module.important_notification.enabled"
|
||||
| "module.important_notification.email_enabled"
|
||||
| "module.server_chan_push.enabled"
|
||||
| "module.bark_push.enabled" => match value.as_bool() {
|
||||
@@ -3385,6 +3387,28 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cyber_continue_failover_defaults_to_disabled() {
|
||||
assert_eq!(
|
||||
admin_system_config_default_value("cyber_continue_failover"),
|
||||
Some(json!(false))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cyber_continue_failover_update_requires_a_boolean() {
|
||||
let update =
|
||||
parse_admin_system_config_update("cyber_continue_failover", br#"{"value":true}"#)
|
||||
.expect("boolean Cyber failover setting should parse");
|
||||
assert_eq!(update.value, json!(true));
|
||||
|
||||
assert!(parse_admin_system_config_update(
|
||||
"cyber_continue_failover",
|
||||
br#"{"value":"true"}"#,
|
||||
)
|
||||
.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_notification_email_config_key_normalizes_to_important_notification() {
|
||||
assert_eq!(
|
||||
|
||||
Reference in New Issue
Block a user