mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 08:18:18 +00:00
refactor(config): migrate server config consumers (#3353)
This commit is contained in:
@@ -27,7 +27,7 @@ categories = ["web-programming", "development-tools", "asynchronous", "api-bindi
|
||||
|
||||
[dependencies]
|
||||
rustfs-targets = { workspace = true }
|
||||
rustfs-config = { workspace = true, features = ["audit", "constants"] }
|
||||
rustfs-config = { workspace = true, features = ["audit", "constants", "server-config-model"] }
|
||||
rustfs-ecstore = { workspace = true }
|
||||
rustfs-s3-types = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
|
||||
@@ -33,7 +33,7 @@ rustfs-audit = "0.1"
|
||||
|
||||
```rust
|
||||
use rustfs_audit::{start_audit_system, AuditLogger};
|
||||
use rustfs_ecstore::config::Config;
|
||||
use rustfs_config::server_config::Config;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
|
||||
@@ -31,8 +31,8 @@ pub fn builtin_target_plugins() -> Vec<TargetPluginDescriptor<AuditEntry>> {
|
||||
mod tests {
|
||||
use super::builtin_target_descriptors;
|
||||
use rustfs_config::audit::AUDIT_AMQP_KEYS;
|
||||
use rustfs_config::server_config::KVS;
|
||||
use rustfs_config::{AMQP_EXCHANGE, AMQP_QUEUE_DIR, AMQP_ROUTING_KEY, AMQP_URL};
|
||||
use rustfs_ecstore::config::KVS;
|
||||
use rustfs_targets::target::ChannelTargetType;
|
||||
|
||||
fn amqp_base_config() -> KVS {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use crate::{AuditEntry, AuditResult, AuditSystem, system::AuditTargetMetricSnapshot};
|
||||
use rustfs_ecstore::config::Config;
|
||||
use rustfs_config::server_config::Config;
|
||||
use std::sync::{Arc, OnceLock};
|
||||
use tracing::{debug, error, trace, warn};
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
use crate::{AuditEntry, AuditError, AuditResult, factory::builtin_target_plugins};
|
||||
use rustfs_config::audit::AUDIT_ROUTE_PREFIX;
|
||||
use rustfs_ecstore::config::{Config, KVS};
|
||||
use rustfs_config::server_config::{Config, KVS};
|
||||
use rustfs_targets::arn::TargetID;
|
||||
use rustfs_targets::{SharedTarget, Target, TargetError, TargetPluginRegistry, TargetRuntimeManager};
|
||||
use tracing::info;
|
||||
|
||||
@@ -16,7 +16,7 @@ use crate::{
|
||||
AuditEntry, AuditError, AuditRegistry, AuditResult, observability,
|
||||
pipeline::{AuditPipeline, AuditRuntimeFacade, AuditRuntimeView},
|
||||
};
|
||||
use rustfs_ecstore::config::Config;
|
||||
use rustfs_config::server_config::Config;
|
||||
use rustfs_targets::{ReplayWorkerManager, Target};
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::{Mutex, RwLock};
|
||||
@@ -537,7 +537,7 @@ mod tests {
|
||||
}
|
||||
|
||||
system
|
||||
.reload_config(rustfs_ecstore::config::Config(HashMap::new()))
|
||||
.reload_config(rustfs_config::server_config::Config(HashMap::new()))
|
||||
.await
|
||||
.expect("reload with empty config should succeed");
|
||||
|
||||
@@ -545,6 +545,6 @@ mod tests {
|
||||
assert!(system.list_targets().await.is_empty());
|
||||
assert_eq!(system.runtime_status_snapshot().await, ReplayWorkerManager::new().snapshot(0));
|
||||
assert_eq!(close_calls.load(Ordering::SeqCst), 1);
|
||||
assert_eq!(*system.config.read().await, Some(rustfs_ecstore::config::Config(HashMap::new())));
|
||||
assert_eq!(*system.config.read().await, Some(rustfs_config::server_config::Config(HashMap::new())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
//! Tests for audit configuration parsing and validation
|
||||
|
||||
use rustfs_ecstore::config::KVS;
|
||||
use rustfs_config::server_config::KVS;
|
||||
|
||||
#[test]
|
||||
fn test_webhook_valid_fields() {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use rustfs_audit::*;
|
||||
use rustfs_ecstore::config::{Config, KVS};
|
||||
use rustfs_config::server_config::{Config, KVS};
|
||||
use std::collections::HashMap;
|
||||
use temp_env::with_vars;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ async fn test_audit_system_startup_performance() {
|
||||
let start = Instant::now();
|
||||
|
||||
// Create minimal config for testing
|
||||
let config = rustfs_ecstore::config::Config(std::collections::HashMap::new());
|
||||
let config = rustfs_config::server_config::Config(std::collections::HashMap::new());
|
||||
|
||||
// System should start quickly even with empty config
|
||||
let _result = timeout(Duration::from_secs(5), system.start(config)).await;
|
||||
@@ -47,12 +47,12 @@ async fn test_concurrent_target_creation() {
|
||||
let registry = AuditRegistry::new();
|
||||
|
||||
// Create config with multiple webhook instances
|
||||
let mut config = rustfs_ecstore::config::Config(std::collections::HashMap::new());
|
||||
let mut config = rustfs_config::server_config::Config(std::collections::HashMap::new());
|
||||
let mut webhook_section = std::collections::HashMap::new();
|
||||
|
||||
// Create multiple instances for concurrent creation test
|
||||
for i in 1..=5 {
|
||||
let mut kvs = rustfs_ecstore::config::KVS::new();
|
||||
let mut kvs = rustfs_config::server_config::KVS::new();
|
||||
kvs.insert("enable".to_string(), "on".to_string());
|
||||
kvs.insert("endpoint".to_string(), format!("http://localhost:302{i}/webhook"));
|
||||
webhook_section.insert(format!("instance_{i}"), kvs);
|
||||
@@ -90,7 +90,7 @@ async fn test_audit_log_dispatch_performance() {
|
||||
let system = AuditSystem::new();
|
||||
|
||||
// Create minimal config
|
||||
let config = rustfs_ecstore::config::Config(HashMap::new());
|
||||
let config = rustfs_config::server_config::Config(HashMap::new());
|
||||
let start_result = system.start(config).await;
|
||||
if start_result.is_err() {
|
||||
println!("AuditSystem failed to start: {start_result:?}");
|
||||
@@ -186,7 +186,7 @@ async fn test_system_state_transitions() {
|
||||
assert_eq!(system.get_state().await, rustfs_audit::system::AuditSystemState::Stopped);
|
||||
|
||||
// Start system
|
||||
let config = rustfs_ecstore::config::Config(std::collections::HashMap::new());
|
||||
let config = rustfs_config::server_config::Config(std::collections::HashMap::new());
|
||||
let start_result = system.start(config).await;
|
||||
|
||||
// Empty config keeps the audit system stopped even when start() succeeds.
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
//! Comprehensive integration tests for the complete audit system
|
||||
|
||||
use rustfs_audit::*;
|
||||
use rustfs_ecstore::config::{Config, KVS};
|
||||
use rustfs_config::server_config::{Config, KVS};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::config::{KV, KVS};
|
||||
use rustfs_config::audit::AUDIT_REDIS_DEFAULT_CHANNEL;
|
||||
use rustfs_config::server_config::{KV, KVS};
|
||||
use rustfs_config::{
|
||||
AMQP_EXCHANGE, AMQP_MANDATORY, AMQP_PASSWORD, AMQP_PERSISTENT, AMQP_QUEUE_DIR, AMQP_QUEUE_LIMIT, AMQP_ROUTING_KEY,
|
||||
AMQP_TLS_CA, AMQP_TLS_CLIENT_CERT, AMQP_TLS_CLIENT_KEY, AMQP_URL, AMQP_USERNAME, COMMENT_KEY, DEFAULT_LIMIT, ENABLE_KEY,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::config::{Config, KVS, audit, notify, oidc, set_global_storage_class, storageclass};
|
||||
use crate::config::{audit, notify, oidc, set_global_storage_class, storageclass};
|
||||
use crate::disk::{MIGRATING_META_BUCKET, RUSTFS_META_BUCKET};
|
||||
use crate::error::{Error, Result};
|
||||
use crate::global::is_first_cluster_node_local;
|
||||
@@ -30,6 +30,7 @@ use rustfs_config::notify::{
|
||||
NOTIFY_WEBHOOK_KEYS, NOTIFY_WEBHOOK_SUB_SYS,
|
||||
};
|
||||
use rustfs_config::oidc::{IDENTITY_OPENID_KEYS, IDENTITY_OPENID_SUB_SYS, OIDC_REDIRECT_URI_DYNAMIC};
|
||||
use rustfs_config::server_config::{Config, KVS};
|
||||
use rustfs_config::{COMMENT_KEY, DEFAULT_DELIMITER, ENABLE_KEY, EnableState, RUSTFS_REGION};
|
||||
use rustfs_storage_api::StorageAdminApi;
|
||||
use rustfs_utils::path::SLASH_SEPARATOR;
|
||||
@@ -293,7 +294,7 @@ fn get_config_file() -> String {
|
||||
format!("{CONFIG_PREFIX}{SLASH_SEPARATOR}{CONFIG_FILE}")
|
||||
}
|
||||
|
||||
fn storage_class_kvs_mut(cfg: &mut Config) -> &mut crate::config::KVS {
|
||||
fn storage_class_kvs_mut(cfg: &mut Config) -> &mut KVS {
|
||||
let sub_cfg = cfg.0.entry(STORAGE_CLASS_SUB_SYS.to_string()).or_insert_with(|| {
|
||||
let mut section = HashMap::new();
|
||||
section.insert(DEFAULT_DELIMITER.to_string(), storageclass::DEFAULT_KVS.clone());
|
||||
@@ -1210,7 +1211,7 @@ mod tests {
|
||||
configs_semantically_equal, decode_server_config_blob, encode_server_config_blob, is_standard_object_server_config,
|
||||
read_config_with_metadata, storage_class_kvs_mut,
|
||||
};
|
||||
use crate::config::{Config, audit, notify, oidc};
|
||||
use crate::config::{audit, notify, oidc};
|
||||
use crate::disk::endpoint::Endpoint;
|
||||
use crate::endpoints::SetupType;
|
||||
use crate::error::{Error, Result};
|
||||
@@ -1228,6 +1229,7 @@ mod tests {
|
||||
NOTIFY_AMQP_SUB_SYS, NOTIFY_KAFKA_SUB_SYS, NOTIFY_MQTT_SUB_SYS, NOTIFY_MYSQL_SUB_SYS, NOTIFY_WEBHOOK_SUB_SYS,
|
||||
};
|
||||
use rustfs_config::oidc::IDENTITY_OPENID_SUB_SYS;
|
||||
use rustfs_config::server_config::{Config, KV, KVS};
|
||||
use rustfs_config::{
|
||||
DEFAULT_DELIMITER, ENABLE_KEY, EnableState, MYSQL_DSN_STRING, MYSQL_MAX_OPEN_CONNECTIONS, MYSQL_QUEUE_DIR, MYSQL_TABLE,
|
||||
};
|
||||
@@ -2152,18 +2154,18 @@ mod tests {
|
||||
webhook_section.insert(DEFAULT_DELIMITER.to_string(), notify::DEFAULT_NOTIFY_WEBHOOK_KVS.clone());
|
||||
webhook_section.insert(
|
||||
"primary".to_string(),
|
||||
crate::config::KVS(vec![
|
||||
crate::config::KV {
|
||||
KVS(vec![
|
||||
KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: EnableState::On.to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::WEBHOOK_ENDPOINT.to_string(),
|
||||
value: "https://example.com/hook".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::WEBHOOK_QUEUE_DIR.to_string(),
|
||||
value: "/tmp/webhook-queue".to_string(),
|
||||
hidden_if_empty: false,
|
||||
@@ -2179,18 +2181,18 @@ mod tests {
|
||||
mqtt_section.insert(DEFAULT_DELIMITER.to_string(), mqtt_default);
|
||||
mqtt_section.insert(
|
||||
"analytics".to_string(),
|
||||
crate::config::KVS(vec![
|
||||
crate::config::KV {
|
||||
KVS(vec![
|
||||
KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: EnableState::On.to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::MQTT_BROKER.to_string(),
|
||||
value: "tcp://127.0.0.1:1883".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::MQTT_QUEUE_DIR.to_string(),
|
||||
value: "".to_string(),
|
||||
hidden_if_empty: false,
|
||||
@@ -2206,23 +2208,23 @@ mod tests {
|
||||
kafka_section.insert(DEFAULT_DELIMITER.to_string(), kafka_default);
|
||||
kafka_section.insert(
|
||||
"streaming".to_string(),
|
||||
crate::config::KVS(vec![
|
||||
crate::config::KV {
|
||||
KVS(vec![
|
||||
KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: EnableState::On.to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::KAFKA_BROKERS.to_string(),
|
||||
value: "127.0.0.1:9092,127.0.0.1:9093".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::KAFKA_ACKS.to_string(),
|
||||
value: "all".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::KAFKA_TLS_ENABLE.to_string(),
|
||||
value: EnableState::On.to_string(),
|
||||
hidden_if_empty: false,
|
||||
@@ -2234,33 +2236,33 @@ mod tests {
|
||||
let mut amqp_section = std::collections::HashMap::new();
|
||||
amqp_section.insert(
|
||||
"primary".to_string(),
|
||||
crate::config::KVS(vec![
|
||||
crate::config::KV {
|
||||
KVS(vec![
|
||||
KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: EnableState::On.to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::AMQP_URL.to_string(),
|
||||
value: "amqp://127.0.0.1:5672/%2f".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::AMQP_EXCHANGE.to_string(),
|
||||
value: "rustfs.events".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::AMQP_ROUTING_KEY.to_string(),
|
||||
value: "objects".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::AMQP_MANDATORY.to_string(),
|
||||
value: "false".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::AMQP_PERSISTENT.to_string(),
|
||||
value: "false".to_string(),
|
||||
hidden_if_empty: false,
|
||||
@@ -2341,18 +2343,18 @@ mod tests {
|
||||
webhook_section.insert(DEFAULT_DELIMITER.to_string(), audit::DEFAULT_AUDIT_WEBHOOK_KVS.clone());
|
||||
webhook_section.insert(
|
||||
"primary".to_string(),
|
||||
crate::config::KVS(vec![
|
||||
crate::config::KV {
|
||||
KVS(vec![
|
||||
KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: EnableState::On.to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::WEBHOOK_ENDPOINT.to_string(),
|
||||
value: "https://example.com/audit-hook".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::WEBHOOK_QUEUE_DIR.to_string(),
|
||||
value: "/tmp/audit-queue".to_string(),
|
||||
hidden_if_empty: false,
|
||||
@@ -2364,33 +2366,33 @@ mod tests {
|
||||
let mut amqp_section = std::collections::HashMap::new();
|
||||
amqp_section.insert(
|
||||
"primary".to_string(),
|
||||
crate::config::KVS(vec![
|
||||
crate::config::KV {
|
||||
KVS(vec![
|
||||
KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: EnableState::On.to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::AMQP_URL.to_string(),
|
||||
value: "amqp://127.0.0.1:5672/%2f".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::AMQP_EXCHANGE.to_string(),
|
||||
value: "rustfs.audit".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::AMQP_ROUTING_KEY.to_string(),
|
||||
value: "audit".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::AMQP_MANDATORY.to_string(),
|
||||
value: "false".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::AMQP_PERSISTENT.to_string(),
|
||||
value: "false".to_string(),
|
||||
hidden_if_empty: false,
|
||||
@@ -2406,13 +2408,13 @@ mod tests {
|
||||
mqtt_section.insert(DEFAULT_DELIMITER.to_string(), mqtt_default);
|
||||
mqtt_section.insert(
|
||||
"analytics".to_string(),
|
||||
crate::config::KVS(vec![
|
||||
crate::config::KV {
|
||||
KVS(vec![
|
||||
KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: EnableState::On.to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::MQTT_BROKER.to_string(),
|
||||
value: "tcp://127.0.0.1:1883".to_string(),
|
||||
hidden_if_empty: false,
|
||||
@@ -2428,13 +2430,13 @@ mod tests {
|
||||
kafka_section.insert(DEFAULT_DELIMITER.to_string(), kafka_default);
|
||||
kafka_section.insert(
|
||||
"auditlog".to_string(),
|
||||
crate::config::KVS(vec![
|
||||
crate::config::KV {
|
||||
KVS(vec![
|
||||
KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: EnableState::On.to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
crate::config::KV {
|
||||
KV {
|
||||
key: rustfs_config::KAFKA_BROKERS.to_string(),
|
||||
value: "127.0.0.1:9092".to_string(),
|
||||
hidden_if_empty: false,
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::config::{KV, KVS};
|
||||
use crate::error::{Error, Result};
|
||||
use rustfs_config::server_config::{KV, KVS};
|
||||
use rustfs_config::{DEFAULT_HEAL_BITROT_CYCLE_SECS, HEAL_BITROT_CYCLE};
|
||||
use rustfs_utils::string::parse_bool;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::config::{KV, KVS};
|
||||
use rustfs_config::notify::NOTIFY_REDIS_DEFAULT_CHANNEL;
|
||||
use rustfs_config::server_config::{KV, KVS};
|
||||
use rustfs_config::{
|
||||
AMQP_EXCHANGE, AMQP_MANDATORY, AMQP_PASSWORD, AMQP_PERSISTENT, AMQP_QUEUE_DIR, AMQP_QUEUE_LIMIT, AMQP_ROUTING_KEY,
|
||||
AMQP_TLS_CA, AMQP_TLS_CLIENT_CERT, AMQP_TLS_CLIENT_KEY, AMQP_URL, AMQP_USERNAME, COMMENT_KEY, DEFAULT_LIMIT, ENABLE_KEY,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::config::{KV, KVS};
|
||||
use rustfs_config::server_config::{KV, KVS};
|
||||
use rustfs_config::{
|
||||
ENABLE_KEY, EnableState,
|
||||
oidc::{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::config::{KV, KVS};
|
||||
use rustfs_config::server_config::{KV, KVS};
|
||||
use rustfs_config::{
|
||||
DEFAULT_SCANNER_BITROT_CYCLE_SECS, DEFAULT_SCANNER_CACHE_SAVE_TIMEOUT_SECS, DEFAULT_SCANNER_CYCLE_MAX_DIRECTORIES,
|
||||
DEFAULT_SCANNER_CYCLE_MAX_DURATION_SECS, DEFAULT_SCANNER_CYCLE_MAX_OBJECTS, DEFAULT_SCANNER_IDLE_MODE,
|
||||
|
||||
@@ -12,9 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use super::KVS;
|
||||
use crate::config::KV;
|
||||
use crate::error::{Error, Result};
|
||||
use rustfs_config::server_config::{KV, KVS};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::env;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
@@ -77,6 +77,7 @@ use lazy_static::lazy_static;
|
||||
use rand::RngExt as _;
|
||||
use rustfs_common::heal_channel::{HealItemType, HealOpts};
|
||||
use rustfs_common::{GLOBAL_LOCAL_NODE_NAME, GLOBAL_RUSTFS_ADDR, GLOBAL_RUSTFS_HOST, GLOBAL_RUSTFS_PORT};
|
||||
use rustfs_config::server_config::Config;
|
||||
use rustfs_filemeta::FileInfo;
|
||||
use rustfs_lock::{LocalClient, LockClient, NamespaceLockWrapper};
|
||||
use rustfs_madmin::heal_commands::HealResultItem;
|
||||
@@ -214,12 +215,12 @@ impl std::fmt::Debug for ECStore {
|
||||
/// remain the single source of truth until the migration is complete.
|
||||
impl ECStore {
|
||||
/// Get server configuration (delegates to global)
|
||||
pub fn get_server_config(&self) -> Option<crate::config::Config> {
|
||||
pub fn get_server_config(&self) -> Option<Config> {
|
||||
crate::config::get_global_server_config()
|
||||
}
|
||||
|
||||
/// Set server configuration (delegates to global)
|
||||
pub fn set_server_config(&self, cfg: crate::config::Config) {
|
||||
pub fn set_server_config(&self, cfg: Config) {
|
||||
crate::config::set_global_server_config(cfg);
|
||||
}
|
||||
|
||||
@@ -264,7 +265,7 @@ impl ECStore {
|
||||
}
|
||||
|
||||
/// Get the server configuration
|
||||
pub fn server_config(&self) -> Option<crate::config::Config> {
|
||||
pub fn server_config(&self) -> Option<Config> {
|
||||
get_global_server_config()
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::config::{KVS, storageclass};
|
||||
use crate::config::storageclass;
|
||||
use crate::disk::error_reduce::{count_errs, reduce_write_quorum_errs};
|
||||
use crate::disk::{self, DiskAPI};
|
||||
use crate::error::{Error, Result};
|
||||
@@ -26,6 +26,7 @@ use crate::{
|
||||
endpoints::Endpoints,
|
||||
};
|
||||
use futures::future::join_all;
|
||||
use rustfs_config::server_config::KVS;
|
||||
use std::collections::{HashMap, hash_map::Entry};
|
||||
use tracing::{debug, info, warn};
|
||||
use uuid::Uuid;
|
||||
|
||||
@@ -30,7 +30,7 @@ workspace = true
|
||||
|
||||
[dependencies]
|
||||
rustfs-credentials = { workspace = true }
|
||||
rustfs-config = { workspace = true, features = ["constants"] }
|
||||
rustfs-config = { workspace = true, features = ["constants", "server-config-model"] }
|
||||
tokio.workspace = true
|
||||
time = { workspace = true, features = ["serde-human-readable"] }
|
||||
serde = { workspace = true, features = ["derive", "rc"] }
|
||||
|
||||
+17
-16
@@ -26,8 +26,9 @@ use openidconnect::{
|
||||
};
|
||||
use reqwest::Client;
|
||||
use rustfs_config::oidc::*;
|
||||
use rustfs_config::server_config::{Config as ServerConfig, KVS};
|
||||
use rustfs_config::{DEFAULT_DELIMITER, ENABLE_KEY, EnableState};
|
||||
use rustfs_ecstore::config::{Config as ServerConfig, KVS, get_global_server_config};
|
||||
use rustfs_ecstore::config::get_global_server_config;
|
||||
use rustfs_policy::policy::{ClaimLookup, get_claim_case_insensitive};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::borrow::Cow;
|
||||
@@ -1867,17 +1868,17 @@ mod tests {
|
||||
fn test_parse_persisted_provider_config() {
|
||||
let mut cfg = ServerConfig::new();
|
||||
let mut kvs = KVS(vec![
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: EnableState::Off.to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: OIDC_CONFIG_URL.to_string(),
|
||||
value: String::new(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: OIDC_CLIENT_ID.to_string(),
|
||||
value: String::new(),
|
||||
hidden_if_empty: false,
|
||||
@@ -1908,17 +1909,17 @@ mod tests {
|
||||
fn test_parse_persisted_provider_config_omitted_roles_claim_is_empty() {
|
||||
let mut cfg = ServerConfig::new();
|
||||
let mut kvs = KVS(vec![
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: EnableState::Off.to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: OIDC_CONFIG_URL.to_string(),
|
||||
value: String::new(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: OIDC_CLIENT_ID.to_string(),
|
||||
value: String::new(),
|
||||
hidden_if_empty: false,
|
||||
@@ -2125,17 +2126,17 @@ mod tests {
|
||||
fn test_parse_persisted_hide_from_ui_off_is_false() {
|
||||
let mut cfg = ServerConfig::new();
|
||||
let mut kvs = KVS(vec![
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: EnableState::On.to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: OIDC_CONFIG_URL.to_string(),
|
||||
value: "https://example.com/.well-known/openid-configuration".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: OIDC_CLIENT_ID.to_string(),
|
||||
value: "console".to_string(),
|
||||
hidden_if_empty: false,
|
||||
@@ -2157,17 +2158,17 @@ mod tests {
|
||||
fn test_parse_persisted_hide_from_ui_missing_defaults_false() {
|
||||
let mut cfg = ServerConfig::new();
|
||||
let kvs = KVS(vec![
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: EnableState::On.to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: OIDC_CONFIG_URL.to_string(),
|
||||
value: "https://example.com/.well-known/openid-configuration".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: OIDC_CLIENT_ID.to_string(),
|
||||
value: "console".to_string(),
|
||||
hidden_if_empty: false,
|
||||
@@ -2188,17 +2189,17 @@ mod tests {
|
||||
fn test_parse_persisted_hide_from_ui() {
|
||||
let mut cfg = ServerConfig::new();
|
||||
let mut kvs = KVS(vec![
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: EnableState::On.to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: OIDC_CONFIG_URL.to_string(),
|
||||
value: "https://example.com/.well-known/openid-configuration".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: OIDC_CLIENT_ID.to_string(),
|
||||
value: "console".to_string(),
|
||||
hidden_if_empty: false,
|
||||
|
||||
@@ -26,7 +26,7 @@ categories = ["web-programming", "development-tools", "filesystem"]
|
||||
documentation = "https://docs.rs/rustfs-notify/latest/rustfs_notify/"
|
||||
|
||||
[dependencies]
|
||||
rustfs-config = { workspace = true, features = ["notify", "constants"] }
|
||||
rustfs-config = { workspace = true, features = ["notify", "constants", "server-config-model"] }
|
||||
rustfs-ecstore = { workspace = true }
|
||||
rustfs-s3-types = { workspace = true }
|
||||
rustfs-s3-ops = { workspace = true }
|
||||
|
||||
@@ -17,11 +17,11 @@ mod base;
|
||||
use base::{LogLevel, init_logger};
|
||||
use rustfs_config::EnableState::On;
|
||||
use rustfs_config::notify::{DEFAULT_TARGET, NOTIFY_MQTT_SUB_SYS, NOTIFY_WEBHOOK_SUB_SYS};
|
||||
use rustfs_config::server_config::{Config, KV, KVS};
|
||||
use rustfs_config::{
|
||||
DEFAULT_LIMIT, ENABLE_KEY, MQTT_BROKER, MQTT_PASSWORD, MQTT_QOS, MQTT_QUEUE_DIR, MQTT_QUEUE_LIMIT, MQTT_TOPIC, MQTT_USERNAME,
|
||||
WEBHOOK_AUTH_TOKEN, WEBHOOK_ENDPOINT, WEBHOOK_QUEUE_DIR, WEBHOOK_QUEUE_LIMIT,
|
||||
};
|
||||
use rustfs_ecstore::config::{Config, KV, KVS};
|
||||
use rustfs_notify::{BucketNotificationConfig, Event, NotificationError};
|
||||
use rustfs_notify::{initialize, notification_system};
|
||||
use rustfs_s3_types::EventName;
|
||||
|
||||
@@ -17,11 +17,11 @@ mod base;
|
||||
use base::{LogLevel, init_logger};
|
||||
use rustfs_config::EnableState::On;
|
||||
use rustfs_config::notify::{DEFAULT_TARGET, NOTIFY_MQTT_SUB_SYS, NOTIFY_WEBHOOK_SUB_SYS};
|
||||
use rustfs_config::server_config::{Config, KV, KVS};
|
||||
use rustfs_config::{
|
||||
DEFAULT_LIMIT, ENABLE_KEY, MQTT_BROKER, MQTT_PASSWORD, MQTT_QOS, MQTT_QUEUE_DIR, MQTT_QUEUE_LIMIT, MQTT_TOPIC, MQTT_USERNAME,
|
||||
WEBHOOK_AUTH_TOKEN, WEBHOOK_ENDPOINT, WEBHOOK_QUEUE_DIR, WEBHOOK_QUEUE_LIMIT,
|
||||
};
|
||||
use rustfs_ecstore::config::{Config, KV, KVS};
|
||||
use rustfs_notify::{BucketNotificationConfig, Event, NotificationError};
|
||||
use rustfs_notify::{initialize, notification_system};
|
||||
use rustfs_s3_types::EventName;
|
||||
|
||||
@@ -19,7 +19,7 @@ use rustfs_config::notify::{
|
||||
NOTIFY_AMQP_SUB_SYS, NOTIFY_KAFKA_SUB_SYS, NOTIFY_MQTT_SUB_SYS, NOTIFY_MYSQL_SUB_SYS, NOTIFY_NATS_SUB_SYS,
|
||||
NOTIFY_POSTGRES_SUB_SYS, NOTIFY_PULSAR_SUB_SYS, NOTIFY_REDIS_SUB_SYS, NOTIFY_WEBHOOK_SUB_SYS,
|
||||
};
|
||||
use rustfs_ecstore::config::{Config, KVS};
|
||||
use rustfs_config::server_config::{Config, KVS};
|
||||
use rustfs_targets::{Target, arn::TargetID};
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::RwLock;
|
||||
@@ -243,7 +243,7 @@ mod tests {
|
||||
NOTIFY_AMQP_SUB_SYS, NOTIFY_KAFKA_SUB_SYS, NOTIFY_MQTT_SUB_SYS, NOTIFY_NATS_SUB_SYS, NOTIFY_POSTGRES_SUB_SYS,
|
||||
NOTIFY_PULSAR_SUB_SYS, NOTIFY_REDIS_SUB_SYS, NOTIFY_WEBHOOK_SUB_SYS,
|
||||
};
|
||||
use rustfs_ecstore::config::Config;
|
||||
use rustfs_config::server_config::Config;
|
||||
use rustfs_targets::ReplayWorkerManager;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::{RwLock, Semaphore};
|
||||
|
||||
@@ -31,8 +31,8 @@ pub fn builtin_target_plugins() -> Vec<TargetPluginDescriptor<Event>> {
|
||||
mod tests {
|
||||
use super::builtin_target_descriptors;
|
||||
use rustfs_config::notify::NOTIFY_AMQP_KEYS;
|
||||
use rustfs_config::server_config::KVS;
|
||||
use rustfs_config::{AMQP_EXCHANGE, AMQP_QUEUE_DIR, AMQP_ROUTING_KEY, AMQP_URL};
|
||||
use rustfs_ecstore::config::KVS;
|
||||
use rustfs_targets::target::ChannelTargetType;
|
||||
|
||||
fn amqp_base_config() -> KVS {
|
||||
|
||||
@@ -16,7 +16,7 @@ use crate::{
|
||||
BucketNotificationConfig, Event, EventArgs, LifecycleError, NotificationError, NotificationMetricSnapshot,
|
||||
NotificationSystem, NotificationTargetMetricSnapshot,
|
||||
};
|
||||
use rustfs_ecstore::config::Config;
|
||||
use rustfs_config::server_config::Config;
|
||||
use rustfs_s3_types::EventName;
|
||||
use rustfs_targets::arn::TargetID;
|
||||
use std::sync::{Arc, OnceLock};
|
||||
|
||||
@@ -22,7 +22,7 @@ use crate::{
|
||||
use hashbrown::HashMap;
|
||||
use metrics::{counter, gauge};
|
||||
use rustfs_config::notify::{DEFAULT_NOTIFY_TARGET_STREAM_CONCURRENCY, ENV_NOTIFY_TARGET_STREAM_CONCURRENCY};
|
||||
use rustfs_ecstore::config::{Config, KVS};
|
||||
use rustfs_config::server_config::{Config, KVS};
|
||||
use rustfs_s3_types::EventName;
|
||||
use rustfs_targets::arn::TargetID;
|
||||
use rustfs_targets::{ReplayWorkerManager, RuntimeTargetHealthSnapshot, SharedTarget};
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
use crate::Event;
|
||||
use crate::factory::builtin_target_plugins;
|
||||
use rustfs_config::notify::NOTIFY_ROUTE_PREFIX;
|
||||
use rustfs_ecstore::config::{Config, KVS};
|
||||
use rustfs_config::server_config::{Config, KVS};
|
||||
use rustfs_targets::{Target, TargetError, TargetPluginRegistry};
|
||||
|
||||
/// Registry for managing target factories
|
||||
|
||||
@@ -26,7 +26,7 @@ use crate::{
|
||||
runtime_view::NotifyRuntimeView,
|
||||
status_view::NotifyStatusView,
|
||||
};
|
||||
use rustfs_ecstore::config::Config;
|
||||
use rustfs_config::server_config::Config;
|
||||
use rustfs_targets::ReplayWorkerManager;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::{RwLock, Semaphore, broadcast};
|
||||
@@ -81,7 +81,7 @@ mod tests {
|
||||
integration::NotificationMetrics, notification_system_subscriber::NotificationSystemSubscriberView,
|
||||
notifier::EventNotifier, pipeline::LiveEventHistory, registry::TargetRegistry, rule_engine::NotifyRuleEngine,
|
||||
};
|
||||
use rustfs_ecstore::config::Config;
|
||||
use rustfs_config::server_config::Config;
|
||||
use rustfs_targets::ReplayWorkerManager;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::{RwLock, Semaphore, broadcast};
|
||||
|
||||
@@ -12,7 +12,7 @@ categories = ["web-programming", "development-tools", "filesystem"]
|
||||
documentation = "https://docs.rs/rustfs-targets/latest/rustfs_targets/"
|
||||
|
||||
[dependencies]
|
||||
rustfs-config = { workspace = true, features = ["notify", "constants", "audit"] }
|
||||
rustfs-config = { workspace = true, features = ["notify", "constants", "audit", "server-config-model"] }
|
||||
rustfs-ecstore = { workspace = true }
|
||||
rustfs-tls-runtime = { workspace = true }
|
||||
rustfs-s3-types = { workspace = true }
|
||||
|
||||
@@ -28,6 +28,7 @@ use rustfs_config::notify::{
|
||||
NOTIFY_POSTGRES_SUB_SYS, NOTIFY_PULSAR_KEYS, NOTIFY_PULSAR_SUB_SYS, NOTIFY_REDIS_DEFAULT_CHANNEL, NOTIFY_REDIS_KEYS,
|
||||
NOTIFY_REDIS_SUB_SYS, NOTIFY_WEBHOOK_KEYS, NOTIFY_WEBHOOK_SUB_SYS,
|
||||
};
|
||||
use rustfs_config::server_config::KVS;
|
||||
use rustfs_config::{
|
||||
AUDIT_DEFAULT_DIR, EVENT_DEFAULT_DIR,
|
||||
audit::{
|
||||
@@ -35,7 +36,6 @@ use rustfs_config::{
|
||||
AUDIT_POSTGRES_SUB_SYS, AUDIT_PULSAR_SUB_SYS, AUDIT_REDIS_SUB_SYS, AUDIT_WEBHOOK_SUB_SYS,
|
||||
},
|
||||
};
|
||||
use rustfs_ecstore::config::KVS;
|
||||
use serde::Serialize;
|
||||
use serde::de::DeserializeOwned;
|
||||
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
use crate::TargetError;
|
||||
use crate::target::pulsar::validate_pulsar_broker;
|
||||
use async_nats::ServerAddr;
|
||||
use rustfs_config::server_config::KVS;
|
||||
use rustfs_config::{
|
||||
DEFAULT_DELIMITER, ENABLE_KEY, EnableState, NATS_CREDENTIALS_FILE, NATS_PASSWORD, NATS_QUEUE_DIR, NATS_SUBJECT, NATS_TLS_CA,
|
||||
NATS_TLS_CLIENT_CERT, NATS_TLS_CLIENT_KEY, NATS_TOKEN, NATS_USERNAME, PULSAR_AUTH_TOKEN, PULSAR_PASSWORD, PULSAR_QUEUE_DIR,
|
||||
PULSAR_TLS_ALLOW_INSECURE, PULSAR_TLS_CA, PULSAR_TLS_HOSTNAME_VERIFICATION, PULSAR_TOPIC, PULSAR_USERNAME,
|
||||
};
|
||||
use rustfs_ecstore::config::KVS;
|
||||
use std::collections::HashSet;
|
||||
use std::path::Path;
|
||||
use std::str::FromStr;
|
||||
@@ -185,10 +185,10 @@ pub(super) fn parse_url(value: &str, field_label: &str) -> Result<Url, TargetErr
|
||||
mod tests {
|
||||
use super::{validate_nats_server_config, validate_pulsar_broker_config};
|
||||
use async_nats::ServerAddr;
|
||||
use rustfs_config::server_config::KVS;
|
||||
use rustfs_config::{
|
||||
NATS_PASSWORD, NATS_QUEUE_DIR, NATS_SUBJECT, NATS_TOKEN, NATS_USERNAME, PULSAR_TLS_ALLOW_INSECURE, PULSAR_TOPIC,
|
||||
};
|
||||
use rustfs_ecstore::config::KVS;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
use super::loader::collect_merged_target_configs_from_env;
|
||||
use crate::domain::TargetDomain;
|
||||
use rustfs_ecstore::config::{Config, KVS};
|
||||
use rustfs_config::server_config::{Config, KVS};
|
||||
use std::collections::HashSet;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
@@ -155,8 +155,8 @@ mod tests {
|
||||
use crate::manifest::builtin_target_manifest;
|
||||
use rustfs_config::audit::{AUDIT_ROUTE_PREFIX, AUDIT_WEBHOOK_KEYS, AUDIT_WEBHOOK_SUB_SYS};
|
||||
use rustfs_config::notify::{NOTIFY_ROUTE_PREFIX, NOTIFY_WEBHOOK_KEYS, NOTIFY_WEBHOOK_SUB_SYS};
|
||||
use rustfs_config::server_config::{Config, KVS};
|
||||
use rustfs_config::{ENABLE_KEY, WEBHOOK_ENDPOINT, WEBHOOK_QUEUE_LIMIT};
|
||||
use rustfs_ecstore::config::{Config, KVS};
|
||||
use std::collections::HashMap;
|
||||
|
||||
fn notify_webhook_descriptor() -> TargetPluginInstanceCompatDescriptor<'static> {
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
// limitations under the License.
|
||||
|
||||
use super::common::{is_target_enabled, split_env_field_and_instance};
|
||||
use rustfs_config::server_config::{Config, KVS};
|
||||
use rustfs_config::{DEFAULT_DELIMITER, ENV_PREFIX};
|
||||
use rustfs_ecstore::config::{Config, KVS};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use tracing::{debug, warn};
|
||||
|
||||
@@ -244,10 +244,10 @@ mod tests {
|
||||
ENV_NOTIFY_REDIS_ENABLE, ENV_NOTIFY_REDIS_RECONNECT_RETRY_ATTEMPTS, ENV_NOTIFY_REDIS_TLS_ALLOW_INSECURE,
|
||||
ENV_NOTIFY_REDIS_URL, NOTIFY_REDIS_KEYS, NOTIFY_ROUTE_PREFIX,
|
||||
};
|
||||
use rustfs_config::server_config::{Config, KVS};
|
||||
use rustfs_config::{
|
||||
ENABLE_KEY, REDIS_RECONNECT_RETRY_ATTEMPTS, REDIS_TLS_ALLOW_INSECURE, REDIS_URL, WEBHOOK_ENDPOINT, WEBHOOK_QUEUE_LIMIT,
|
||||
};
|
||||
use rustfs_ecstore::config::{Config, KVS};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -27,6 +27,7 @@ use crate::target::{
|
||||
webhook::WebhookArgs,
|
||||
};
|
||||
use rumqttc::QoS;
|
||||
use rustfs_config::server_config::KVS;
|
||||
use rustfs_config::{
|
||||
AMQP_EXCHANGE, AMQP_MANDATORY, AMQP_PASSWORD, AMQP_PERSISTENT, AMQP_QUEUE_DIR, AMQP_QUEUE_LIMIT, AMQP_ROUTING_KEY,
|
||||
AMQP_TLS_CA, AMQP_TLS_CLIENT_CERT, AMQP_TLS_CLIENT_KEY, AMQP_URL, AMQP_USERNAME, DEFAULT_LIMIT, KAFKA_ACKS, KAFKA_BROKERS,
|
||||
@@ -47,7 +48,6 @@ use rustfs_config::{
|
||||
REDIS_USERNAME, RUSTFS_WEBHOOK_SKIP_TLS_VERIFY_DEFAULT, WEBHOOK_AUTH_TOKEN, WEBHOOK_CLIENT_CA, WEBHOOK_CLIENT_CERT,
|
||||
WEBHOOK_CLIENT_KEY, WEBHOOK_ENDPOINT, WEBHOOK_QUEUE_DIR, WEBHOOK_QUEUE_LIMIT, WEBHOOK_SKIP_TLS_VERIFY,
|
||||
};
|
||||
use rustfs_ecstore::config::KVS;
|
||||
use std::path::Path;
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -602,6 +602,7 @@ mod tests {
|
||||
kafka::{KAFKA_SASL_PLAIN, KAFKA_SASL_SCRAM_SHA_512},
|
||||
postgres::PostgresFormat,
|
||||
};
|
||||
use rustfs_config::server_config::KVS;
|
||||
use rustfs_config::{
|
||||
AMQP_EXCHANGE, AMQP_MANDATORY, AMQP_PASSWORD, AMQP_PERSISTENT, AMQP_QUEUE_DIR, AMQP_ROUTING_KEY, AMQP_TLS_CLIENT_CERT,
|
||||
AMQP_TLS_CLIENT_KEY, AMQP_URL, AMQP_USERNAME, KAFKA_ACKS, KAFKA_BROKERS, KAFKA_SASL_ENABLE, KAFKA_SASL_MECHANISM,
|
||||
@@ -611,7 +612,6 @@ mod tests {
|
||||
REDIS_CHANNEL, REDIS_CONNECTION_TIMEOUT, REDIS_MAX_RETRY_DELAY, REDIS_MIN_RETRY_DELAY, REDIS_PIPELINE_BUFFER_SIZE,
|
||||
REDIS_RECONNECT_RETRY_ATTEMPTS, REDIS_RESPONSE_TIMEOUT, REDIS_TLS_ALLOW_INSECURE, REDIS_URL,
|
||||
};
|
||||
use rustfs_ecstore::config::KVS;
|
||||
|
||||
fn absolute_test_path(path: &str) -> String {
|
||||
std::env::temp_dir().join(path).to_string_lossy().into_owned()
|
||||
|
||||
@@ -18,7 +18,7 @@ use crate::{
|
||||
manifest::{TargetPluginManifest, builtin_target_manifest},
|
||||
};
|
||||
use hashbrown::HashMap;
|
||||
use rustfs_ecstore::config::{Config, KVS};
|
||||
use rustfs_config::server_config::{Config, KVS};
|
||||
use serde::Serialize;
|
||||
use serde::de::DeserializeOwned;
|
||||
use std::collections::HashSet;
|
||||
@@ -349,7 +349,7 @@ mod tests {
|
||||
use crate::{StoreError, Target, TargetError};
|
||||
use async_trait::async_trait;
|
||||
use rustfs_config::ENABLE_KEY;
|
||||
use rustfs_ecstore::config::{Config, KVS};
|
||||
use rustfs_config::server_config::{Config, KVS};
|
||||
use serde::{Serialize, de::DeserializeOwned};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -5,18 +5,17 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
|
||||
## Current Context
|
||||
|
||||
- Issue: [`rustfs/backlog#660`](https://github.com/rustfs/backlog/issues/660)
|
||||
- Branch: `overtrue/arch-config-model-extraction`
|
||||
- Baseline: `origin/main` at `dd5035916e62c031d40ecdf9363763a881517abb`
|
||||
- PR type for this branch: `api-extraction`
|
||||
- Branch: `overtrue/arch-config-consumers`
|
||||
- Baseline: `origin/main` at `22059911807158aae9617415a916cf1156558b7b`
|
||||
- PR type for this branch: `consumer-migration`
|
||||
- Runtime behavior changes: none.
|
||||
- Rust code changes: move the pure server-config model (`Config`, `KV`, `KVS`,
|
||||
`DEFAULT_KVS`, and `register_default_kvs`) into
|
||||
`rustfs_config::server_config`, keep the old `rustfs_ecstore::config` model
|
||||
path as a temporary re-export, and leave persistence helpers/global server
|
||||
config state in ECStore.
|
||||
- Rust code changes: migrate admin/runtime/audit/notify/targets/iam and
|
||||
ECStore service/default model consumers from the temporary
|
||||
`rustfs_ecstore::config` model path to `rustfs_config::server_config`, and
|
||||
enable the `server-config-model` feature in affected crates.
|
||||
- CI/script changes: none.
|
||||
- Docs changes: record API-012 completion, current CFG-003/CFG-004 extraction
|
||||
context, compatibility cleanup marker, and verification evidence.
|
||||
- Docs changes: record CFG-005/CFG-006 consumer-migration context, verification
|
||||
evidence, and the preserved ECStore runtime-state boundary.
|
||||
|
||||
## Phase 0 Tasks
|
||||
|
||||
@@ -79,16 +78,32 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
|
||||
`rustfs-config` as the target package, `server_config` as the future model
|
||||
module, allowed dependencies, forbidden dependencies, preserved shape, and
|
||||
extraction verification gates.
|
||||
- [~] `CFG-003` Move pure model definitions.
|
||||
- Current branch: move only `Config`, `KV`, `KVS`, and
|
||||
default-registration surface into `rustfs-config`; keep persistence helpers
|
||||
and global server-config state in `ecstore`.
|
||||
- [x] `CFG-003` Move pure model definitions.
|
||||
- Completed slice: `rustfs/rustfs#3351` moved only `Config`, `KV`, `KVS`,
|
||||
and default-registration surface into `rustfs-config`; persistence helpers
|
||||
and global server-config state remain in `ecstore`.
|
||||
- Must preserve: tuple struct shapes, serde alias behavior, default
|
||||
application, internal JSON shape, and existing persisted config semantics.
|
||||
- [~] `CFG-004` Keep old `ecstore::config::*` compatibility path.
|
||||
- Current branch: re-export moved model types and default-registration
|
||||
surface from `rustfs_ecstore::config` with `RUSTFS_COMPAT_TODO(CFG-004)`
|
||||
and cleanup-register coverage.
|
||||
- [x] `CFG-004` Keep old `ecstore::config::*` compatibility path.
|
||||
- Completed slice: `rustfs/rustfs#3351` re-exported moved model types and
|
||||
default-registration surface from `rustfs_ecstore::config` with
|
||||
`RUSTFS_COMPAT_TODO(CFG-004)` and cleanup-register coverage.
|
||||
- [x] `CFG-005` Migrate external server-config model consumers.
|
||||
- Current branch: migrate admin handlers, admin services, runtime context,
|
||||
server audit/event setup, and the audit/notify/targets/iam crates from the
|
||||
temporary `rustfs_ecstore::config::{Config, KV, KVS}` model path to
|
||||
`rustfs_config::server_config`.
|
||||
- Acceptance: external consumers use the model crate for pure config types
|
||||
while still using ECStore for persistence helpers, global server-config
|
||||
accessors, storage-class helpers, and startup initialization.
|
||||
- [x] `CFG-006` Migrate ECStore service/default model consumers.
|
||||
- Current branch: migrate ECStore config default modules, shared config
|
||||
helpers, and store accessor signatures to the `rustfs_config` model type
|
||||
while preserving ECStore-owned persistence and runtime state.
|
||||
- Acceptance: ECStore internals no longer depend on the old compatibility
|
||||
model import path except the deliberate compatibility smoke test; the old
|
||||
public re-export remains available for downstream callers until CFG-004 is
|
||||
cleaned up.
|
||||
|
||||
## Phase 1 Security Governance Tasks
|
||||
|
||||
@@ -313,41 +328,45 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
|
||||
|
||||
## Next PRs
|
||||
|
||||
1. `api-extraction`: move only the pure server-config model into rustfs-config
|
||||
as CFG-003 and keep the old rustfs_ecstore::config::* path with
|
||||
RUSTFS_COMPAT_TODO(CFG-004) and cleanup-register coverage.
|
||||
2. `consumer-migration`: migrate external consumers one group at a time only
|
||||
after the model path and compatibility shim are stable.
|
||||
3. `security-change`: make Local KMS unsafe defaults explicit development
|
||||
1. `api-extraction`: remove the temporary `rustfs_ecstore::config` model
|
||||
re-export after downstream compatibility policy allows CFG-004 cleanup.
|
||||
2. `security-change`: make Local KMS unsafe defaults explicit development
|
||||
opt-ins or production failures in KMSD-002.
|
||||
4. `security-change`: make Vault unsafe defaults explicit development opt-ins
|
||||
3. `security-change`: make Vault unsafe defaults explicit development opt-ins
|
||||
or production failures in KMSD-003.
|
||||
|
||||
## Pre-Push Review Log
|
||||
|
||||
| Expert | Status | Notes |
|
||||
|---|---|---|
|
||||
| Quality/architecture | pass | Confirmed this stays a pure model extraction into `rustfs_config::server_config`; persistence helpers, global state, runtime consumers, startup wiring, and storage hot paths remain in ECStore or unchanged. |
|
||||
| Migration preservation | pass | Confirmed the old `rustfs_ecstore::config` model path remains available through `RUSTFS_COMPAT_TODO(CFG-004)`, while tuple shapes, serde alias behavior, defaults, marshal/unmarshal, and persisted JSON shape are preserved. |
|
||||
| Testing/verification | pass | Confirmed focused config/model tests, compile checks, dependency tree, migration guards, diff hygiene, and added-line risk scan are sufficient before push; full pre-commit is skipped under the current larger-granularity instruction. |
|
||||
| Quality/architecture | pass | Confirmed this is only a model-consumer migration and feature-gate update; ECStore persistence helpers, global state, startup wiring, config persistence, and storage hot paths stay unchanged. |
|
||||
| Migration preservation | pass | Confirmed the old `rustfs_ecstore::config` model path remains available through `RUSTFS_COMPAT_TODO(CFG-004)`, with no tuple-shape, serde, default, or persisted JSON changes. |
|
||||
| Testing/verification | pass | Confirmed focused config/admin/audit/notify/targets/iam tests, compile checks, migration guards, boundary scans, and added-line risk scan are sufficient; full pre-commit is skipped under the current larger-granularity instruction. |
|
||||
|
||||
## Verification Notes
|
||||
|
||||
Passed:
|
||||
- `cargo fmt --all --check`.
|
||||
- `cargo check -p rustfs-config --features server-config-model`.
|
||||
- `cargo check -p rustfs-config`.
|
||||
- `cargo check -p rustfs-ecstore`.
|
||||
- `cargo check -p rustfs-config -p rustfs-ecstore -p rustfs --lib`.
|
||||
- `cargo check -p rustfs-targets -p rustfs-notify -p rustfs-audit -p rustfs-iam -p rustfs-scanner -p rustfs --lib`.
|
||||
- `cargo test -p rustfs-config --features server-config-model server_config --lib`; 3 passed.
|
||||
- `cargo check -p rustfs-config -p rustfs-audit -p rustfs-notify -p rustfs-targets -p rustfs-iam -p rustfs-ecstore -p rustfs --lib`.
|
||||
- `cargo test -p rustfs-config --features server-config-model --lib`; 29 passed.
|
||||
- `cargo test -p rustfs-ecstore config --lib`; 60 passed.
|
||||
- `cargo test -p rustfs-targets config --lib`; 65 passed.
|
||||
- `cargo test -p rustfs-notify config_manager --lib`; 12 passed.
|
||||
- `cargo test -p rustfs-audit --lib`; 5 passed.
|
||||
- `cargo test -p rustfs-iam oidc --lib`; 53 passed.
|
||||
- `cargo test -p rustfs admin::handlers::config_admin --lib`; 29 passed.
|
||||
- `cargo test -p rustfs admin::service::config --lib`; 6 passed.
|
||||
- `./scripts/check_architecture_migration_rules.sh`.
|
||||
- `./scripts/check_layer_dependencies.sh`.
|
||||
- `./scripts/check_metrics_migration_refs.sh`.
|
||||
- `./scripts/check_unsafe_code_allowances.sh`.
|
||||
- `git diff --check`.
|
||||
- `cargo tree -p rustfs-config --edges normal --features server-config-model`.
|
||||
- External old-model path scan:
|
||||
`rustfs_ecstore::config::{Config, KV, KVS}` is absent from `rustfs/src`,
|
||||
`crates/audit`, `crates/notify`, `crates/targets`, and `crates/iam`.
|
||||
- ECStore runtime helper scan: no `rustfs_config::server_config::{init,
|
||||
get_global_server_config, set_global_server_config,
|
||||
set_global_storage_class, com, storageclass}` usage exists.
|
||||
- Added-line risk scan found no production `unwrap`/`expect`, lossy numeric
|
||||
casts, stringly public errors, boxed dynamic errors, stdout/stderr printing,
|
||||
or relaxed atomic ordering.
|
||||
@@ -355,25 +374,22 @@ Passed:
|
||||
Notes:
|
||||
- Full pre-commit may be skipped if focused tests, compile checks, and guards
|
||||
pass, per the current instruction to increase PR granularity.
|
||||
- This slice moves only the pure server-config model and default-registration
|
||||
surface. ECStore retains persistence helpers, ConfigSys, global server-config
|
||||
state, storage-class global state, startup wiring, and all runtime consumers.
|
||||
- This slice migrates model consumers only. ECStore retains persistence helpers,
|
||||
ConfigSys, global server-config state, storage-class global state, startup
|
||||
wiring, and all storage/config persistence logic.
|
||||
- The old rustfs_ecstore::config model path intentionally remains as a
|
||||
temporary compatibility re-export with `RUSTFS_COMPAT_TODO(CFG-004)` and a
|
||||
matching cleanup-register entry.
|
||||
- A focused ECStore test proves the old path re-exports the moved model type;
|
||||
rustfs-config tests cover KVS behavior, legacy hiddenIfEmpty alias
|
||||
compatibility, and marshal/unmarshal internal JSON shape.
|
||||
- The remaining ECStore old-path references are limited to the deliberate
|
||||
compatibility smoke test in `crates/ecstore/src/config/mod.rs`.
|
||||
|
||||
## Handoff Notes
|
||||
|
||||
- Keep this CFG-003/CFG-004 slice as an `api-extraction` PR that only moves the
|
||||
pure server-config model to `rustfs_config::server_config` and keeps old
|
||||
`rustfs_ecstore::config` model import paths compiling.
|
||||
- Keep this CFG-005/CFG-006 slice as a `consumer-migration` PR that only
|
||||
updates model type imports and affected crate feature gates.
|
||||
- Do not move `ConfigSys`, `GLOBAL_SERVER_CONFIG`, storage-class global state,
|
||||
`read_config_without_migrate`, `save_server_config`, config-object helpers,
|
||||
startup wiring, runtime consumers, or storage persistence logic in this PR.
|
||||
- Do not migrate external consumers in this PR; consumer migration starts after
|
||||
the new model path and compatibility shim are merged.
|
||||
startup wiring, storage-class helpers, ECStore persistence helpers, or storage
|
||||
persistence logic in this PR.
|
||||
- Do not add temporary compatibility code unless a matching
|
||||
`RUSTFS_COMPAT_TODO(<task-id>)` marker and cleanup-register entry are added.
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ workspace = true
|
||||
rustfs-heal = { workspace = true }
|
||||
rustfs-audit = { workspace = true }
|
||||
rustfs-common = { workspace = true }
|
||||
rustfs-config = { workspace = true, features = ["constants", "notify"] }
|
||||
rustfs-config = { workspace = true, features = ["constants", "notify", "server-config-model"] }
|
||||
rustfs-crypto = { workspace = true }
|
||||
rustfs-credentials = { workspace = true }
|
||||
rustfs-ecstore = { workspace = true }
|
||||
|
||||
@@ -32,8 +32,8 @@ use hyper::Method;
|
||||
use matchit::Params;
|
||||
use rustfs_audit::audit_system;
|
||||
use rustfs_config::audit::AUDIT_ROUTE_PREFIX;
|
||||
use rustfs_config::server_config::Config;
|
||||
use rustfs_config::{AUDIT_DEFAULT_DIR, MAX_ADMIN_REQUEST_BODY_SIZE};
|
||||
use rustfs_ecstore::config::Config;
|
||||
use rustfs_policy::policy::action::{Action, AdminAction};
|
||||
use rustfs_targets::catalog::builtin::builtin_audit_target_admin_descriptors;
|
||||
use s3s::{Body, S3Request, S3Response, S3Result, s3_error};
|
||||
@@ -263,8 +263,8 @@ mod tests {
|
||||
use crate::admin::handlers::target_descriptor::collect_validated_key_values as shared_collect_validated_key_values;
|
||||
use matchit::Router;
|
||||
use rustfs_config::audit::{AUDIT_AMQP_SUB_SYS, AUDIT_KAFKA_SUB_SYS, AUDIT_WEBHOOK_KEYS, AUDIT_WEBHOOK_SUB_SYS};
|
||||
use rustfs_config::server_config::{KV, KVS};
|
||||
use rustfs_config::{DEFAULT_DELIMITER, ENABLE_KEY, ENV_PREFIX};
|
||||
use rustfs_ecstore::config::{KV, KVS};
|
||||
use serial_test::serial;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use temp_env::{with_var, with_vars, with_vars_unset};
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
use crate::admin::handlers::target_descriptor::AdminTargetSpec;
|
||||
use rustfs_audit::{audit_system, start_audit_system as start_global_audit_system, system::AuditSystemState};
|
||||
use rustfs_config::DEFAULT_DELIMITER;
|
||||
use rustfs_ecstore::config::Config;
|
||||
use rustfs_config::server_config::Config;
|
||||
use s3s::{S3Result, s3_error};
|
||||
|
||||
pub(crate) async fn load_server_config_from_store() -> S3Result<Config> {
|
||||
@@ -100,7 +100,7 @@ pub(crate) async fn set_audit_target_config(
|
||||
specs: &[AdminTargetSpec],
|
||||
subsystem: &str,
|
||||
target_name: &str,
|
||||
kvs: rustfs_ecstore::config::KVS,
|
||||
kvs: rustfs_config::server_config::KVS,
|
||||
) -> S3Result<()> {
|
||||
update_audit_config_and_reload(specs, |config| {
|
||||
config
|
||||
|
||||
@@ -48,6 +48,7 @@ use rustfs_config::oidc::{
|
||||
OIDC_CLIENT_ID, OIDC_CLIENT_SECRET, OIDC_CONFIG_URL, OIDC_DISPLAY_NAME, OIDC_EMAIL_CLAIM, OIDC_GROUPS_CLAIM,
|
||||
OIDC_REDIRECT_URI, OIDC_REDIRECT_URI_DYNAMIC, OIDC_ROLE_POLICY, OIDC_SCOPES, OIDC_USERNAME_CLAIM,
|
||||
};
|
||||
use rustfs_config::server_config::{Config as ServerConfig, DEFAULT_KVS, KV, KVS};
|
||||
use rustfs_config::{
|
||||
COMMENT_KEY, DEFAULT_DELIMITER, ENABLE_KEY, ENV_PREFIX, ENV_SCANNER_ALERT_EXCESS_FOLDERS,
|
||||
ENV_SCANNER_ALERT_EXCESS_VERSION_SIZE, ENV_SCANNER_ALERT_EXCESS_VERSIONS, ENV_SCANNER_BITROT_CYCLE_SECS,
|
||||
@@ -68,7 +69,7 @@ use rustfs_credentials::Credentials;
|
||||
use rustfs_ecstore::config::com::STORAGE_CLASS_SUB_SYS;
|
||||
use rustfs_ecstore::config::com::{delete_config, read_config, read_config_without_migrate, save_config, save_server_config};
|
||||
use rustfs_ecstore::config::storageclass::{INLINE_BLOCK_ENV, OPTIMIZE_ENV, RRS_ENV, STANDARD_ENV};
|
||||
use rustfs_ecstore::config::{Config as ServerConfig, DEFAULT_KVS, KV, KVS, get_global_server_config, set_global_server_config};
|
||||
use rustfs_ecstore::config::{get_global_server_config, set_global_server_config};
|
||||
use rustfs_ecstore::disk::RUSTFS_META_BUCKET;
|
||||
use rustfs_ecstore::new_object_layer_fn;
|
||||
use rustfs_ecstore::store_api::ListOperations;
|
||||
|
||||
@@ -32,8 +32,8 @@ use http::StatusCode;
|
||||
use hyper::Method;
|
||||
use matchit::Params;
|
||||
use rustfs_config::notify::NOTIFY_ROUTE_PREFIX;
|
||||
use rustfs_config::server_config::Config;
|
||||
use rustfs_config::{EVENT_DEFAULT_DIR, MAX_ADMIN_REQUEST_BODY_SIZE};
|
||||
use rustfs_ecstore::config::Config;
|
||||
use rustfs_policy::policy::action::{Action, AdminAction};
|
||||
use rustfs_targets::catalog::builtin::builtin_notify_target_admin_descriptors;
|
||||
use s3s::{Body, S3Request, S3Response, S3Result, s3_error};
|
||||
@@ -299,8 +299,8 @@ mod tests {
|
||||
};
|
||||
use matchit::Router;
|
||||
use rustfs_config::notify::{NOTIFY_AMQP_SUB_SYS, NOTIFY_KAFKA_SUB_SYS, NOTIFY_MQTT_SUB_SYS, NOTIFY_WEBHOOK_SUB_SYS};
|
||||
use rustfs_config::server_config::{KV, KVS};
|
||||
use rustfs_config::{DEFAULT_DELIMITER, ENABLE_KEY};
|
||||
use rustfs_ecstore::config::{KV, KVS};
|
||||
use rustfs_targets::arn::TargetID;
|
||||
use serial_test::serial;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use rustfs_ecstore::config::Config;
|
||||
use rustfs_config::server_config::Config;
|
||||
use s3s::{S3Result, s3_error};
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -29,7 +29,7 @@ pub(crate) async fn load_notification_config_snapshot() -> S3Result<(Arc<rustfs_
|
||||
pub(crate) async fn set_notification_target_config(
|
||||
subsystem: &str,
|
||||
target_name: &str,
|
||||
kvs: rustfs_ecstore::config::KVS,
|
||||
kvs: rustfs_config::server_config::KVS,
|
||||
) -> S3Result<()> {
|
||||
let system = get_notification_system()?;
|
||||
system
|
||||
|
||||
@@ -26,9 +26,10 @@ use rustfs_config::oidc::{
|
||||
OIDC_DEFAULT_USERNAME_CLAIM, OIDC_DISPLAY_NAME, OIDC_EMAIL_CLAIM, OIDC_GROUPS_CLAIM, OIDC_HIDE_FROM_UI, OIDC_OTHER_AUDIENCES,
|
||||
OIDC_REDIRECT_URI, OIDC_REDIRECT_URI_DYNAMIC, OIDC_ROLE_POLICY, OIDC_ROLES_CLAIM, OIDC_SCOPES, OIDC_USERNAME_CLAIM,
|
||||
};
|
||||
use rustfs_config::server_config::Config as ServerConfig;
|
||||
use rustfs_config::{DEFAULT_DELIMITER, ENABLE_KEY, EnableState, MAX_ADMIN_REQUEST_BODY_SIZE};
|
||||
use rustfs_ecstore::config::com::{read_config_without_migrate, save_server_config};
|
||||
use rustfs_ecstore::config::{Config as ServerConfig, get_global_server_config};
|
||||
use rustfs_ecstore::config::get_global_server_config;
|
||||
use rustfs_ecstore::new_object_layer_fn;
|
||||
use rustfs_policy::policy::action::{Action, AdminAction};
|
||||
use s3s::{Body, S3Error, S3ErrorCode, S3Request, S3Response, S3Result, s3_error};
|
||||
@@ -791,13 +792,13 @@ fn oidc_restart_required_from_active_config(config: &ServerConfig, active_config
|
||||
!= rustfs_iam::oidc::load_effective_oidc_provider_configs(active_config)
|
||||
}
|
||||
|
||||
fn default_oidc_kvs() -> s3s::S3Result<rustfs_ecstore::config::KVS> {
|
||||
fn default_oidc_kvs() -> s3s::S3Result<rustfs_config::server_config::KVS> {
|
||||
ServerConfig::new()
|
||||
.get_value(IDENTITY_OPENID_SUB_SYS, DEFAULT_DELIMITER)
|
||||
.ok_or_else(|| s3_error!(InternalError, "default OIDC configuration missing"))
|
||||
}
|
||||
|
||||
fn set_kvs_value(kvs: &mut rustfs_ecstore::config::KVS, key: &str, value: String) {
|
||||
fn set_kvs_value(kvs: &mut rustfs_config::server_config::KVS, key: &str, value: String) {
|
||||
if let Some(existing) = kvs.0.iter_mut().find(|kv| kv.key == key) {
|
||||
existing.value = value;
|
||||
return;
|
||||
|
||||
@@ -39,8 +39,8 @@ use matchit::Params;
|
||||
use rustfs_audit::audit_system;
|
||||
use rustfs_config::audit::AUDIT_ROUTE_PREFIX;
|
||||
use rustfs_config::notify::NOTIFY_ROUTE_PREFIX;
|
||||
use rustfs_config::server_config::{Config, KVS};
|
||||
use rustfs_config::{AUDIT_DEFAULT_DIR, EVENT_DEFAULT_DIR, MAX_ADMIN_REQUEST_BODY_SIZE};
|
||||
use rustfs_ecstore::config::{Config, KVS};
|
||||
use rustfs_policy::policy::action::{Action, AdminAction};
|
||||
use rustfs_targets::catalog::builtin::{builtin_audit_target_admin_descriptors, builtin_notify_target_admin_descriptors};
|
||||
use rustfs_targets::manifest::builtin_target_manifest;
|
||||
@@ -868,8 +868,8 @@ mod tests {
|
||||
use rustfs_config::audit::AUDIT_WEBHOOK_SUB_SYS;
|
||||
use rustfs_config::notify::NOTIFY_ROUTE_PREFIX;
|
||||
use rustfs_config::notify::NOTIFY_WEBHOOK_SUB_SYS;
|
||||
use rustfs_config::server_config::{Config, KV, KVS};
|
||||
use rustfs_config::{ENABLE_KEY, WEBHOOK_AUTH_TOKEN, WEBHOOK_ENDPOINT};
|
||||
use rustfs_ecstore::config::{Config, KV, KVS};
|
||||
use rustfs_targets::TargetDomain;
|
||||
use s3s::{Body, S3Request};
|
||||
use std::collections::HashMap;
|
||||
|
||||
@@ -691,7 +691,7 @@ fn config_enabled(value: Option<String>) -> bool {
|
||||
matches!(value.as_deref(), Some("on" | "true" | "enabled"))
|
||||
}
|
||||
|
||||
fn ldap_settings_from_kvs(kvs: &rustfs_ecstore::config::KVS) -> (LDAPSettings, LDAPConfigSettings) {
|
||||
fn ldap_settings_from_kvs(kvs: &rustfs_config::server_config::KVS) -> (LDAPSettings, LDAPConfigSettings) {
|
||||
let enabled = config_enabled(kvs.lookup("enable"));
|
||||
let settings = LDAPSettings {
|
||||
is_ldap_enabled: enabled,
|
||||
@@ -4508,28 +4508,28 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_ldap_settings_from_kvs_reads_minio_style_keys() {
|
||||
let kvs = rustfs_ecstore::config::KVS(vec![
|
||||
rustfs_ecstore::config::KV {
|
||||
let kvs = rustfs_config::server_config::KVS(vec![
|
||||
rustfs_config::server_config::KV {
|
||||
key: "enable".to_string(),
|
||||
value: "on".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: "user_dn_search_base_dn".to_string(),
|
||||
value: "ou=people,dc=example,dc=com".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: "user_dn_search_filter".to_string(),
|
||||
value: "(uid=%s)".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: "group_search_base_dn".to_string(),
|
||||
value: "ou=groups,dc=example,dc=com".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: "group_search_filter".to_string(),
|
||||
value: "(&(objectclass=groupOfNames)(member=%s))".to_string(),
|
||||
hidden_if_empty: false,
|
||||
|
||||
@@ -16,12 +16,12 @@ use futures::StreamExt;
|
||||
use futures::future::BoxFuture;
|
||||
use hashbrown::HashSet as HbHashSet;
|
||||
use http::{HeaderMap, HeaderValue, StatusCode};
|
||||
use rustfs_config::server_config::{Config, KVS};
|
||||
use rustfs_config::{
|
||||
AMQP_QUEUE_DIR, ENABLE_KEY, EnableState, KAFKA_BROKERS, KAFKA_QUEUE_DIR, KAFKA_TOPIC, MQTT_BROKER, MQTT_PASSWORD, MQTT_QOS,
|
||||
MQTT_TLS_CA, MQTT_TLS_CLIENT_CERT, MQTT_TLS_CLIENT_KEY, MQTT_TLS_POLICY, MQTT_TLS_TRUST_LEAF_AS_CA, MQTT_TOPIC,
|
||||
MQTT_USERNAME, MQTT_WS_PATH_ALLOWLIST, MYSQL_QUEUE_DIR, POSTGRES_QUEUE_DIR, REDIS_QUEUE_DIR,
|
||||
};
|
||||
use rustfs_ecstore::config::{Config, KVS};
|
||||
use rustfs_targets::SharedTarget;
|
||||
use rustfs_targets::{
|
||||
BuiltinTargetAdminDescriptor, TargetAdminMetadata, TargetDomain, TargetError, TargetRequestValidator,
|
||||
@@ -904,8 +904,8 @@ async fn validate_redis_request(
|
||||
})
|
||||
}
|
||||
|
||||
fn to_kvs(kv_map: &HashMap<String, String>) -> rustfs_ecstore::config::KVS {
|
||||
let mut kvs = rustfs_ecstore::config::KVS::new();
|
||||
fn to_kvs(kv_map: &HashMap<String, String>) -> rustfs_config::server_config::KVS {
|
||||
let mut kvs = rustfs_config::server_config::KVS::new();
|
||||
for (key, value) in kv_map {
|
||||
kvs.insert(key.clone(), value.clone());
|
||||
}
|
||||
|
||||
+30
-29
@@ -36,6 +36,7 @@ use matchit::Params;
|
||||
use matchit::Router;
|
||||
use reqwest::Url;
|
||||
use rustfs_config::notify::NOTIFY_WEBHOOK_SUB_SYS;
|
||||
use rustfs_config::server_config::Config;
|
||||
use rustfs_config::{
|
||||
ENABLE_KEY, WEBHOOK_AUTH_TOKEN, WEBHOOK_CLIENT_CA, WEBHOOK_CLIENT_CERT, WEBHOOK_CLIENT_KEY, WEBHOOK_ENDPOINT,
|
||||
WEBHOOK_SKIP_TLS_VERIFY,
|
||||
@@ -54,7 +55,7 @@ use rustfs_ecstore::bucket::target::{BucketTarget, BucketTargetType, BucketTarge
|
||||
use rustfs_ecstore::bucket::versioning::VersioningApi;
|
||||
use rustfs_ecstore::bucket::versioning_sys::BucketVersioningSys;
|
||||
use rustfs_ecstore::config::com::read_config_without_migrate;
|
||||
use rustfs_ecstore::config::{Config, get_global_server_config};
|
||||
use rustfs_ecstore::config::get_global_server_config;
|
||||
use rustfs_ecstore::global::GLOBAL_BOOT_TIME;
|
||||
use rustfs_ecstore::notification_sys::get_global_notification_sys;
|
||||
use rustfs_ecstore::rpc::PeerRestClient;
|
||||
@@ -3265,22 +3266,22 @@ mod tests {
|
||||
let arn = "arn:acme:s3-object-lambda::transformer:webhook"
|
||||
.parse::<rustfs_targets::arn::ARN>()
|
||||
.expect("arn should parse");
|
||||
let config = rustfs_ecstore::config::Config(std::collections::HashMap::from([(
|
||||
let config = rustfs_config::server_config::Config(std::collections::HashMap::from([(
|
||||
LAMBDA_WEBHOOK_SUB_SYS.to_string(),
|
||||
std::collections::HashMap::from([(
|
||||
"transformer".to_string(),
|
||||
rustfs_ecstore::config::KVS(vec![
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KVS(vec![
|
||||
rustfs_config::server_config::KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: "on".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: WEBHOOK_ENDPOINT.to_string(),
|
||||
value: "https://example.com/transform".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: WEBHOOK_AUTH_TOKEN.to_string(),
|
||||
value: "secret-token".to_string(),
|
||||
hidden_if_empty: true,
|
||||
@@ -3302,17 +3303,17 @@ mod tests {
|
||||
let arn = "arn:acme:s3-object-lambda::transformer:webhook-csv"
|
||||
.parse::<rustfs_targets::arn::ARN>()
|
||||
.expect("arn should parse");
|
||||
let config = rustfs_ecstore::config::Config(std::collections::HashMap::from([(
|
||||
let config = rustfs_config::server_config::Config(std::collections::HashMap::from([(
|
||||
LAMBDA_WEBHOOK_SUB_SYS.to_string(),
|
||||
std::collections::HashMap::from([(
|
||||
"transformer".to_string(),
|
||||
rustfs_ecstore::config::KVS(vec![
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KVS(vec![
|
||||
rustfs_config::server_config::KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: "on".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: WEBHOOK_ENDPOINT.to_string(),
|
||||
value: "https://example.com/transform-csv".to_string(),
|
||||
hidden_if_empty: false,
|
||||
@@ -3330,22 +3331,22 @@ mod tests {
|
||||
let arn = "arn:acme:s3-object-lambda::transformer:webhook"
|
||||
.parse::<rustfs_targets::arn::ARN>()
|
||||
.expect("arn should parse");
|
||||
let config = rustfs_ecstore::config::Config(std::collections::HashMap::from([(
|
||||
let config = rustfs_config::server_config::Config(std::collections::HashMap::from([(
|
||||
LAMBDA_WEBHOOK_SUB_SYS.to_string(),
|
||||
std::collections::HashMap::from([(
|
||||
"transformer".to_string(),
|
||||
rustfs_ecstore::config::KVS(vec![
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KVS(vec![
|
||||
rustfs_config::server_config::KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: "on".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: WEBHOOK_ENDPOINT.to_string(),
|
||||
value: "https://example.com/transform".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: WEBHOOK_RESPONSE_HEADER_TIMEOUT.to_string(),
|
||||
value: "2s".to_string(),
|
||||
hidden_if_empty: false,
|
||||
@@ -3363,17 +3364,17 @@ mod tests {
|
||||
let arn = "arn:acme:s3-object-lambda::transformer:webhook"
|
||||
.parse::<rustfs_targets::arn::ARN>()
|
||||
.expect("arn should parse");
|
||||
let config = rustfs_ecstore::config::Config(std::collections::HashMap::from([(
|
||||
let config = rustfs_config::server_config::Config(std::collections::HashMap::from([(
|
||||
NOTIFY_WEBHOOK_SUB_SYS.to_string(),
|
||||
std::collections::HashMap::from([(
|
||||
"transformer".to_string(),
|
||||
rustfs_ecstore::config::KVS(vec![
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KVS(vec![
|
||||
rustfs_config::server_config::KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: "on".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: WEBHOOK_ENDPOINT.to_string(),
|
||||
value: "https://example.com/notify-transform".to_string(),
|
||||
hidden_if_empty: false,
|
||||
@@ -3391,22 +3392,22 @@ mod tests {
|
||||
let arn = "arn:acme:s3-object-lambda::transformer:webhook"
|
||||
.parse::<rustfs_targets::arn::ARN>()
|
||||
.expect("arn should parse");
|
||||
let config = rustfs_ecstore::config::Config(std::collections::HashMap::from([(
|
||||
let config = rustfs_config::server_config::Config(std::collections::HashMap::from([(
|
||||
LAMBDA_WEBHOOK_SUB_SYS.to_string(),
|
||||
std::collections::HashMap::from([(
|
||||
"transformer".to_string(),
|
||||
rustfs_ecstore::config::KVS(vec![
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KVS(vec![
|
||||
rustfs_config::server_config::KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: "on".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: WEBHOOK_ENDPOINT.to_string(),
|
||||
value: "https://example.com/transform".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: WEBHOOK_RESPONSE_HEADER_TIMEOUT.to_string(),
|
||||
value: "definitely-not-a-duration".to_string(),
|
||||
hidden_if_empty: false,
|
||||
@@ -3425,7 +3426,7 @@ mod tests {
|
||||
let unsupported = "arn:acme:s3-object-lambda::transformer:mqtt"
|
||||
.parse::<rustfs_targets::arn::ARN>()
|
||||
.expect("arn should parse");
|
||||
let empty_config = rustfs_ecstore::config::Config(std::collections::HashMap::new());
|
||||
let empty_config = rustfs_config::server_config::Config(std::collections::HashMap::new());
|
||||
let unsupported_err = resolve_object_lambda_webhook_config_from_server_config(&empty_config, &unsupported)
|
||||
.expect_err("unsupported target type should fail");
|
||||
assert_eq!(unsupported_err.code(), &S3ErrorCode::NotImplemented);
|
||||
@@ -3433,17 +3434,17 @@ mod tests {
|
||||
let webhook = "arn:acme:s3-object-lambda::transformer:webhook"
|
||||
.parse::<rustfs_targets::arn::ARN>()
|
||||
.expect("arn should parse");
|
||||
let disabled_config = rustfs_ecstore::config::Config(std::collections::HashMap::from([(
|
||||
let disabled_config = rustfs_config::server_config::Config(std::collections::HashMap::from([(
|
||||
LAMBDA_WEBHOOK_SUB_SYS.to_string(),
|
||||
std::collections::HashMap::from([(
|
||||
"transformer".to_string(),
|
||||
rustfs_ecstore::config::KVS(vec![
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KVS(vec![
|
||||
rustfs_config::server_config::KV {
|
||||
key: ENABLE_KEY.to_string(),
|
||||
value: "off".to_string(),
|
||||
hidden_if_empty: false,
|
||||
},
|
||||
rustfs_ecstore::config::KV {
|
||||
rustfs_config::server_config::KV {
|
||||
key: WEBHOOK_ENDPOINT.to_string(),
|
||||
value: "https://example.com/transform".to_string(),
|
||||
hidden_if_empty: false,
|
||||
|
||||
@@ -16,12 +16,13 @@ use rustfs_audit::reload_audit_config;
|
||||
use rustfs_config::audit::{AUDIT_MQTT_SUB_SYS, AUDIT_REDIS_DEFAULT_CHANNEL, AUDIT_WEBHOOK_SUB_SYS};
|
||||
use rustfs_config::notify::{NOTIFY_MQTT_SUB_SYS, NOTIFY_REDIS_DEFAULT_CHANNEL, NOTIFY_WEBHOOK_SUB_SYS};
|
||||
use rustfs_config::oidc::IDENTITY_OPENID_SUB_SYS;
|
||||
use rustfs_config::server_config::{Config as ServerConfig, KVS};
|
||||
use rustfs_config::{AUDIT_DEFAULT_DIR, EVENT_DEFAULT_DIR};
|
||||
use rustfs_config::{DEFAULT_DELIMITER, ENABLE_KEY, EnableState};
|
||||
use rustfs_config::{HEAL_SUB_SYS, SCANNER_SUB_SYS};
|
||||
use rustfs_ecstore::config::com::{STORAGE_CLASS_SUB_SYS, read_config_without_migrate};
|
||||
use rustfs_ecstore::config::storageclass;
|
||||
use rustfs_ecstore::config::{Config as ServerConfig, KVS, set_global_server_config, set_global_storage_class};
|
||||
use rustfs_ecstore::config::{set_global_server_config, set_global_storage_class};
|
||||
use rustfs_ecstore::new_object_layer_fn;
|
||||
use rustfs_ecstore::notification_sys::get_global_notification_sys;
|
||||
use rustfs_iam::oidc::load_oidc_provider_configs_from_server_config;
|
||||
|
||||
@@ -18,8 +18,9 @@
|
||||
|
||||
use crate::config::{RustFSBufferConfig, get_global_buffer_config};
|
||||
use async_trait::async_trait;
|
||||
use rustfs_config::server_config::Config;
|
||||
use rustfs_ecstore::bucket::metadata_sys::{BucketMetadataSys, get_global_bucket_metadata_sys};
|
||||
use rustfs_ecstore::config::{Config, get_global_server_config};
|
||||
use rustfs_ecstore::config::get_global_server_config;
|
||||
use rustfs_ecstore::endpoints::EndpointServerPools;
|
||||
use rustfs_ecstore::global::{get_global_endpoints_opt, get_global_region, get_global_tier_config_mgr};
|
||||
use rustfs_ecstore::store::ECStore;
|
||||
|
||||
@@ -20,7 +20,7 @@ use tracing::{info, warn};
|
||||
|
||||
static AUDIT_MODULE_ENABLED: AtomicBool = AtomicBool::new(rustfs_config::DEFAULT_AUDIT_ENABLE);
|
||||
|
||||
fn server_config_from_context() -> Option<rustfs_ecstore::config::Config> {
|
||||
fn server_config_from_context() -> Option<rustfs_config::server_config::Config> {
|
||||
resolve_server_config()
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ pub fn is_audit_module_enabled() -> bool {
|
||||
AUDIT_MODULE_ENABLED.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
fn has_any_audit_targets(config: &rustfs_ecstore::config::Config) -> bool {
|
||||
fn has_any_audit_targets(config: &rustfs_config::server_config::Config) -> bool {
|
||||
for &subsystem in rustfs_config::audit::AUDIT_SUB_SYSTEMS {
|
||||
let Some(targets) = config.0.get(subsystem) else {
|
||||
continue;
|
||||
|
||||
@@ -24,7 +24,7 @@ use tracing::{error, info, instrument, warn};
|
||||
|
||||
static NOTIFY_MODULE_ENABLED: AtomicBool = AtomicBool::new(rustfs_config::DEFAULT_NOTIFY_ENABLE);
|
||||
|
||||
fn server_config_from_context() -> Option<rustfs_ecstore::config::Config> {
|
||||
fn server_config_from_context() -> Option<rustfs_config::server_config::Config> {
|
||||
resolve_server_config()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user