mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Make factory upload limit configurable and increase default to mitigate #105
This commit is contained in:
@@ -318,6 +318,12 @@ impl <C: Clone + Send> super::ConfigProvider<C> for CubeConfig {
|
||||
crate::factory::Factory::from_config(&self.factory, &<Self as super::ConfigProvider<()>>::server_config(self), builtin_factory_provider).await
|
||||
}
|
||||
|
||||
fn factory_config(&self) -> super::FactoryConfig {
|
||||
super::FactoryConfig {
|
||||
upload_limit: self.factory.upload_limit,
|
||||
}
|
||||
}
|
||||
|
||||
fn cubes(&self) -> &'_ indexmap::IndexMap<String, crate::persist::Cube> {
|
||||
&self.cubes
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ mod cubes_json;
|
||||
pub use cubes_json::CubeConfig;
|
||||
|
||||
mod traits;
|
||||
pub use traits::{ConfigProvider, DevMessageProvider, ServerConfig, GarageUpgrades, GarageUpgradeIncrement, ChatSystemConfig, GameEventSequence, GameEvents, GameRotationStrategy, GameEvent, GameMap, GameVisibility, GameType, SingleplayerConfig, VehicleInfo, VehicleDescriptor, QueueChangeMode, Point, Sphere, MapConfig, LinksConfig, FakePlayer, ClientEmulator, EnergyConfig, BattleArenaResolver, PitSettings, PitWinCondition, TeamDeathMatchSettings, ShopEntriesResolver, ShopAction, ShopGain, PromoCode, MultiplayerSettings, BattleArenaCrystalParams, VehicleValidators, TeamChoosers};
|
||||
pub use traits::{ConfigProvider, DevMessageProvider, ServerConfig, GarageUpgrades, GarageUpgradeIncrement, ChatSystemConfig, GameEventSequence, GameEvents, GameRotationStrategy, GameEvent, GameMap, GameVisibility, GameType, SingleplayerConfig, VehicleInfo, VehicleDescriptor, QueueChangeMode, Point, Sphere, MapConfig, LinksConfig, FakePlayer, ClientEmulator, EnergyConfig, BattleArenaResolver, PitSettings, PitWinCondition, TeamDeathMatchSettings, ShopEntriesResolver, ShopAction, ShopGain, PromoCode, MultiplayerSettings, BattleArenaCrystalParams, VehicleValidators, TeamChoosers, FactoryConfig};
|
||||
|
||||
mod validation;
|
||||
pub use validation::{SelfValidator, ValidationInfo, ValidationMessage};
|
||||
|
||||
@@ -21,6 +21,7 @@ pub trait ConfigProvider<C: Clone> {
|
||||
fn server_config(&self) -> ServerConfig;
|
||||
fn garage_upgrades(&self) -> GarageUpgrades;
|
||||
async fn factory(&self, builtin_factory_provider: &(dyn (Fn() -> oj_rc_database::FactoryDatabase) + Sync)) -> Result<crate::factory::Factory, Box<dyn std::error::Error + 'static>>;
|
||||
fn factory_config(&self) -> FactoryConfig;
|
||||
fn cubes(&self) -> &'_ indexmap::IndexMap<String, crate::persist::Cube>;
|
||||
fn chat_system_config(&self) -> ChatSystemConfig;
|
||||
fn gamemode_events(&self) -> GameEventSequence;
|
||||
@@ -143,6 +144,10 @@ impl GarageUpgrades {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct FactoryConfig {
|
||||
pub upload_limit: i32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ChatSystemConfig {
|
||||
pub command_channel: String,
|
||||
|
||||
@@ -4,6 +4,8 @@ use serde::{Serialize, Deserialize};
|
||||
pub struct FactoryConfig {
|
||||
#[serde(default = "default_variant")]
|
||||
pub adapter: AdapterSettings,
|
||||
#[serde(default = "default_upload_limit")]
|
||||
pub upload_limit: i32,
|
||||
}
|
||||
|
||||
impl super::config::SelfValidator for FactoryConfig {
|
||||
@@ -18,6 +20,10 @@ fn default_variant() -> AdapterSettings {
|
||||
AdapterSettings::BuiltIn
|
||||
}
|
||||
|
||||
fn default_upload_limit() -> i32 {
|
||||
4096
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[serde(tag = "variant")]
|
||||
pub enum AdapterSettings {
|
||||
|
||||
Reference in New Issue
Block a user