-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mm): add config to opt-in individual games for host networking &…
… root containers (#549) fix(mm): attempting to run a root container will log to stderr Fixes RVT-3523 Fixes MIS-144
- Loading branch information
1 parent
748aaa8
commit be9ddd6
Showing
26 changed files
with
296 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
6 changes: 6 additions & 0 deletions
6
svc/pkg/mm-config/db/mm-config/migrations/20240228172257_toggle_root_host.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TABLE games ( | ||
game_id UUID PRIMARY KEY, | ||
host_networking_enabled BOOLEAN NOT NULL DEFAULT FALSE, | ||
root_user_enabled BOOLEAN NOT NULL DEFAULT FALSE | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "mm-config-game-get" | ||
version = "0.0.1" | ||
edition = "2021" | ||
authors = ["Rivet Gaming, LLC <developer@rivet.gg>"] | ||
license = "Apache-2.0" | ||
|
||
[dependencies] | ||
chirp-client = { path = "../../../../../lib/chirp/client" } | ||
rivet-operation = { path = "../../../../../lib/operation/core" } | ||
|
||
[dependencies.sqlx] | ||
version = "0.7" | ||
default-features = false | ||
|
||
[dev-dependencies] | ||
chirp-worker = { path = "../../../../../lib/chirp/worker" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[service] | ||
name = "mm-config-game-get" | ||
|
||
[runtime] | ||
kind = "rust" | ||
|
||
[operation] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use proto::backend::{self, pkg::*}; | ||
use rivet_operation::prelude::*; | ||
|
||
#[derive(sqlx::FromRow)] | ||
struct GameRow { | ||
game_id: Uuid, | ||
host_networking_enabled: bool, | ||
root_user_enabled: bool, | ||
} | ||
|
||
#[operation(name = "mm-config-game-get")] | ||
pub async fn handle( | ||
ctx: OperationContext<mm_config::game_get::Request>, | ||
) -> GlobalResult<mm_config::game_get::Response> { | ||
let game_ids = ctx | ||
.game_ids | ||
.iter() | ||
.map(common::Uuid::as_uuid) | ||
.collect::<Vec<_>>(); | ||
|
||
let rows = sql_fetch_all!( | ||
[ctx, GameRow] | ||
" | ||
SELECT game_id, host_networking_enabled, root_user_enabled | ||
FROM db_mm_config.games | ||
WHERE game_id = ANY($1) | ||
", | ||
&game_ids, | ||
) | ||
.await?; | ||
|
||
let games = game_ids | ||
.iter() | ||
.map(|game_id| { | ||
let row = rows.iter().find(|row| row.game_id == *game_id); | ||
mm_config::game_get::response::Game { | ||
game_id: Some((*game_id).into()), | ||
config: Some(backend::matchmaker::GameConfig { | ||
host_networking_enabled: row.map_or(false, |row| row.host_networking_enabled), | ||
root_user_enabled: row.map_or(false, |row| row.root_user_enabled), | ||
}), | ||
} | ||
}) | ||
.collect(); | ||
|
||
Ok(mm_config::game_get::Response { games }) | ||
} |
Oops, something went wrong.