Skip to content

Commit

Permalink
chore(settings): disallow unknown props (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFlurry committed Aug 21, 2024
1 parent a9ea424 commit d81d7a6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rivet-toolchain/src/config/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
};

#[derive(Default, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Settings {
#[serde(default)]
pub backend: BackendConfig,
Expand All @@ -20,6 +21,7 @@ pub struct Settings {
}

#[derive(Default, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct BackendConfig {
/// Env vars to pass to all OpenGB commands.
#[serde(default)]
Expand All @@ -38,6 +40,7 @@ pub struct BackendConfig {
}

#[derive(Default, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct BackendSdkConfig {
/// Env vars to pass to the deploy OpenGB commands.
#[serde(default)]
Expand All @@ -47,6 +50,7 @@ pub struct BackendSdkConfig {
}

#[derive(Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct BackendDevConfig {
/// Env vars to pass to the deploy OpenGB commands.
#[serde(default)]
Expand All @@ -72,6 +76,7 @@ impl BackendDevConfig {
}

#[derive(Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct BackendDeployConfig {
/// Env vars to pass to the deploy OpenGB commands.
#[serde(default)]
Expand All @@ -97,12 +102,14 @@ impl BackendDeployConfig {
}

#[derive(Default, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct GameServerConfig {
#[serde(default)]
pub deploy: GameServerDeployConfig,
}

#[derive(Default, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct GameServerDeployConfig {
#[serde(default)]
pub dockerfile_path: Option<String>,
Expand All @@ -122,6 +129,7 @@ pub struct GameServerDeployConfig {
}

#[derive(Default, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct NetConfig {
#[serde(default)]
pub disable_upload_multipart: bool,
Expand Down

0 comments on commit d81d7a6

Please sign in to comment.