1 parent
ecc201ef50
commit
698e3c4a1b
124 files changed
+4593
-2721
No files matched your search
+19
-5
@@ -492,11 +492,11 @@ impl AppConfig {
|
||||
return Err("Redis sessions require REDIS_URL or REDIS_SENTINEL_NODES + REDIS_SENTINEL_MASTER".to_string());
|
||||
}
|
||||
}
|
||||
if self.cluster_mode
|
||||
&& self.session_backend == "database"
|
||||
&& self.database_backend == "sqlite"
|
||||
{
|
||||
return Err("CLUSTER_MODE with database sessions requires mysql/pgsql, or configure SESSION_BACKEND=redis".to_string());
|
||||
if self.cluster_mode && self.database_backend == "sqlite" {
|
||||
return Err(
|
||||
"CLUSTER_MODE requires a shared mysql/pgsql application database; Redis only replaces session persistence"
|
||||
.to_string(),
|
||||
);
|
||||
}
|
||||
if (self.cluster_mode
|
||||
|| self.session_backend == "redis"
|
||||
@@ -809,4 +809,18 @@ mod tests {
|
||||
vec![TrustedProxy::Ip("127.0.0.1".parse().unwrap())]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cluster_mode_rejects_local_sqlite_even_with_redis_sessions() {
|
||||
let config = AppConfig {
|
||||
database_backend: "sqlite".to_string(),
|
||||
session_backend: "redis".to_string(),
|
||||
redis_url: Some("redis://127.0.0.1:6379/".to_string()),
|
||||
session_encryption_key: Some("configured-shared-key".to_string()),
|
||||
cluster_mode: true,
|
||||
..AppConfig::default()
|
||||
};
|
||||
let error = config.validate().unwrap_err();
|
||||
assert!(error.contains("shared mysql/pgsql application database"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user