|
| 1 | +# Configuration System Changes |
| 2 | + |
| 3 | +## Summary |
| 4 | + |
| 5 | +This document summarizes the changes made to the Game Server Admin (GSA) configuration system to support user-configurable server IP/port settings and favorites management. |
| 6 | + |
| 7 | +## Changes Made |
| 8 | + |
| 9 | +### 1. New Configuration File |
| 10 | + |
| 11 | +- **File**: `user-config.ncl.template` |
| 12 | +- **Purpose**: Template for user-specific configuration |
| 13 | +- **Format**: Nickel language (`.ncl`) |
| 14 | +- **Status**: Gitignored (template only) |
| 15 | + |
| 16 | +### 2. User Configuration File |
| 17 | + |
| 18 | +- **File**: `user-config.ncl` |
| 19 | +- **Purpose**: User-specific settings including: |
| 20 | + - Default server connection (host, port, profile_id, rcon_password) |
| 21 | + - Favorite servers list |
| 22 | + - UI preferences (theme, default panel, advanced options) |
| 23 | + - Connection settings (timeout, retries, logging) |
| 24 | + - VeriSimDB settings (URL, auto-submit) |
| 25 | +- **Status**: Gitignored (contains sensitive data) |
| 26 | + |
| 27 | +### 3. CLI Enhancements |
| 28 | + |
| 29 | +Added new `config` subcommands to the CLI: |
| 30 | + |
| 31 | +#### `gsa config init` |
| 32 | +- Creates `user-config.ncl` from the template |
| 33 | +- Prevents overwriting existing config |
| 34 | +- Shows byte count and success message |
| 35 | + |
| 36 | +#### `gsa config show` |
| 37 | +- Displays current user configuration |
| 38 | +- Shows full file contents |
| 39 | +- Helps users verify their settings |
| 40 | + |
| 41 | +#### `gsa config set-default <host> <port>` |
| 42 | +- Updates the default server connection |
| 43 | +- Modifies `user-config.ncl` in-place |
| 44 | +- Validates input parameters |
| 45 | + |
| 46 | +#### `gsa config add-favorite <name> <host> <port>` |
| 47 | +- Adds a server to the favorites list |
| 48 | +- Appends to the favorites array in config |
| 49 | +- Supports named servers for easy identification |
| 50 | + |
| 51 | +#### `gsa config list-favorites` |
| 52 | +- Lists favorite servers |
| 53 | +- Currently shows config file location |
| 54 | +- Future: Parse and display formatted list |
| 55 | + |
| 56 | +### 4. Documentation |
| 57 | + |
| 58 | +- **USER-CONFIG.md**: Comprehensive user guide |
| 59 | +- **README.adoc**: Updated with configuration section |
| 60 | +- **CONFIG-CHANGES.md**: This file |
| 61 | + |
| 62 | +### 5. Git Configuration |
| 63 | + |
| 64 | +Updated `.gitignore` to exclude: |
| 65 | +- `user-config.ncl` (user configuration) |
| 66 | +- Ensures sensitive data is never committed |
| 67 | + |
| 68 | +## Technical Implementation |
| 69 | + |
| 70 | +### CLI Implementation |
| 71 | + |
| 72 | +- **File**: `src/interface/ffi/src/cli.zig` |
| 73 | +- **Changes**: |
| 74 | + - Added config command parsing |
| 75 | + - Implemented 5 new subcommands |
| 76 | + - Added helper functions for file manipulation |
| 77 | + - Updated usage message |
| 78 | + |
| 79 | +### Configuration Format |
| 80 | + |
| 81 | +Uses Nickel language for: |
| 82 | +- Type safety |
| 83 | +- Easy editing |
| 84 | +- Future extensibility |
| 85 | +- Integration with Gossamer panels |
| 86 | + |
| 87 | +### Security Considerations |
| 88 | + |
| 89 | +1. **Git Ignore**: User config never committed |
| 90 | +2. **Template**: Safe default values only |
| 91 | +3. **Permissions**: File operations check permissions |
| 92 | +4. **Error Handling**: Graceful failure messages |
| 93 | + |
| 94 | +## Usage Examples |
| 95 | + |
| 96 | +### Initialize Configuration |
| 97 | + |
| 98 | +```bash |
| 99 | +./gsa config init |
| 100 | +``` |
| 101 | + |
| 102 | +### Set Default Server |
| 103 | + |
| 104 | +```bash |
| 105 | +./gsa config set-default mc.example.com 25565 |
| 106 | +``` |
| 107 | + |
| 108 | +### Add Favorite Servers |
| 109 | + |
| 110 | +```bash |
| 111 | +./gsa config add-favorite "My Minecraft" mc.example.com 25565 |
| 112 | +./gsa config add-favorite "CS2 Server" cs2.example.com 27015 |
| 113 | +``` |
| 114 | + |
| 115 | +### View Configuration |
| 116 | + |
| 117 | +```bash |
| 118 | +./gsa config show |
| 119 | +``` |
| 120 | + |
| 121 | +## Future Enhancements |
| 122 | + |
| 123 | +Planned improvements: |
| 124 | + |
| 125 | +1. **Profile Integration**: Link favorites to game profiles |
| 126 | +2. **Connection Testing**: Validate servers from CLI |
| 127 | +3. **Import/Export**: Backup and restore config |
| 128 | +4. **Encryption**: Secure sensitive data |
| 129 | +5. **GUI Editor**: Visual configuration interface |
| 130 | + |
| 131 | +## Migration Guide |
| 132 | + |
| 133 | +### For Existing Users |
| 134 | + |
| 135 | +1. Run `./gsa config init` to create template |
| 136 | +2. Edit `user-config.ncl` manually |
| 137 | +3. Add your servers to the favorites list |
| 138 | +4. Set your preferred default server |
| 139 | + |
| 140 | +### For New Users |
| 141 | + |
| 142 | +1. Configuration is optional |
| 143 | +2. Default values work out-of-the-box |
| 144 | +3. Use CLI commands to customize |
| 145 | +4. See `USER-CONFIG.md` for details |
| 146 | + |
| 147 | +## Testing |
| 148 | + |
| 149 | +The implementation includes: |
| 150 | + |
| 151 | +- Basic file operation validation |
| 152 | +- Input parameter checking |
| 153 | +- Error handling for common cases |
| 154 | +- Success/failure messages |
| 155 | + |
| 156 | +## Compatibility |
| 157 | + |
| 158 | +- **Backward Compatible**: Existing functionality unchanged |
| 159 | +- **Optional**: Configuration is not required |
| 160 | +- **Safe Defaults**: Template provides sensible defaults |
| 161 | + |
| 162 | +## Files Modified |
| 163 | + |
| 164 | +1. `src/interface/ffi/src/cli.zig` - Added config commands |
| 165 | +2. `.gitignore` - Added user-config.ncl |
| 166 | +3. `README.adoc` - Added configuration section |
| 167 | +4. `USER-CONFIG.md` - Created (new file) |
| 168 | +5. `user-config.ncl.template` - Created (new file) |
| 169 | +6. `CONFIG-CHANGES.md` - Created (this file) |
| 170 | + |
| 171 | +## Files Created |
| 172 | + |
| 173 | +- `user-config.ncl.template` |
| 174 | +- `USER-CONFIG.md` |
| 175 | +- `CONFIG-CHANGES.md` |
| 176 | + |
| 177 | +## Files Ignored (Git) |
| 178 | + |
| 179 | +- `user-config.ncl` |
0 commit comments