
Game Configuration: Configuration Files
This is Part 8 of the Game Configuration series. Configuration files let you define editable game config templates that users can customize directly from GameCP β without SSHing into the server or using the file manager.
What Are Configuration Files?
Many games use text-based config files (like server.properties, server.cfg, or config.json) to control server settings. GameCP's Configuration Files system lets you:
- Define the structure of these files in the game config
- Expose specific settings as editable fields in the server settings UI
- Automatically write the file to disk with the user's values on startup
This means users can change game settings through a clean, labeled form instead of editing raw config files.
Adding a Configuration File
Click Add Config File to open the editor. Each config file requires:
Basic Properties
| Property | Description |
|---|---|
| Name | A human-readable name (e.g., "Server Properties") |
| Description | What this config file controls |
| Folder | The directory path inside the server (e.g., /) |
| Filename | The actual file name (e.g., server.properties) |
| File Type | The format: properties, yaml, json, ini, xml, toml, or text |
Fields
Each config file contains fields β the individual settings that users can edit. Fields have:
| Property | Description |
|---|---|
| Key | The setting key in the file (e.g., max-players) |
| Label | The human-readable name shown to users (e.g., "Max Players") |
| Description | Help text explaining the setting |
| Default Value | The initial value |
| Type | Input type: text, number, select, toggle |
| Required | Whether the field must have a value |
File Types
The file type determines how GameCP writes the config file:
| Type | Format | Example |
|---|---|---|
| properties | key=value per line | Minecraft server.properties |
| yaml | YAML structure | Various modern games |
| json | JSON object | Node.js game servers |
| ini | [Section] + key=value | Source engine games |
| xml | XML elements | Some legacy games |
| toml | TOML format | Rust, newer configs |
| text | Raw text template | Custom formats |
Variable Substitution
Config file field values support variable substitution using {{VARIABLE_NAME}} syntax. This lets config values reference environment variables:
{{SERVER_NAME}}β resolves to the server's name variable{{MAX_PLAYERS}}β resolves to the max players variable{{PORT}}β resolves to the assigned port
This creates a connection between the environment variables users edit and the actual config file content.
Ordering and Toggling
- Drag to reorder config files in the list
- Toggle individual files on/off β disabled files won't be written to disk
- Config files show their file path, file type, and field count in the list view
How It Works at Runtime
When a game server starts:
- GameCP reads the config file definition from the game config
- Substitutes all variable references with actual values
- Writes the file to the correct path inside the server's data directory
- The game reads the file on startup with the user's custom values
If a user changes a setting, the file is regenerated on the next restart.
Tips
- Start with the most important settings and add more fields over time β you don't need to expose every possible setting
- Use select type for fields with fixed options (like game mode or difficulty) to prevent invalid values
- The file path is relative to the server's data directory β use
/or leave the folder empty for the root - Config files are a great way to make a game template user-friendly without requiring any command-line knowledge
- If the game has multiple config files, create a separate config file entry for each one