rivet-gg / cli

Apache License 2.0
3 stars 3 forks source link

`init` generates an incomplete config #261

Open malted opened 1 week ago

malted commented 1 week ago

Validation should ideally pass after init is complete.

This means rivet init should help you through matchmaking configuration too

greptile-apps[bot] commented 1 week ago

To address the issue of init generating an incomplete config, follow these steps:

  1. Update init.rs:

    • Modify the create_config_unreal function to include matchmaking configuration prompts and defaults.
    • Add fields for matchmaker configuration in the generated rivet.yaml file.
  2. Update config.yaml and config-prod.yaml:

    • Ensure these templates include default matchmaking configurations.
  3. Example Code Changes:

    // In `init.rs`, inside `create_config_unreal` function
    let matchmaker_config = rivet_term::prompt::PromptBuilder::default()
       .message("Configure matchmaker? (yes/no)")
       .default_value("yes")
       .build()?
       .bool(term)
       .await?;
    
    if matchmaker_config {
       // Add default matchmaker configuration
       let matchmaker_yaml = r#"
       matchmaker:
         max_players: 32
         tier: basic-1d1
         game_modes:
           default: {}
         docker:
           dockerfile: server.debug.Dockerfile
           ports:
             default:
               port: 7777
               protocol: udp
       "#;
       fs::write(&config_path, matchmaker_yaml).await?;
       rivet_term::status::success("Added matchmaker configuration", "");
    }
  4. Ensure Validation:

    • Make sure the read_config function in config.rs can handle the new fields and validate them properly.

These changes will guide users through matchmaking configuration during rivet init and ensure the generated config passes validation.

References

/cli/src/commands/init.rs /cli/src/commands/config.rs /cli/tpl/unreal_config/config.yaml /cli/tpl/unreal_config/config-prod.yaml /cli/src/commands/sidekick/generate_config.rs /cli/src/commands/sidekick/mod.rs /sdks/rust/src/models/cloud_version_matchmaker_game_mode_find_config.rs /sdks/rust/src/models/cloud_version_matchmaker_game_mode_create_config.rs /sdks/rust/src/models/cloud_version_matchmaker_game_mode_join_config.rs

Ask Greptile

linear[bot] commented 1 week ago

CLI-81 `init` generates an incomplete config