Skip to content

Commit ee8c737

Browse files
feat(config): Add user-configurable server IP/port and favorites system
- Created user-config.ncl.template with comprehensive configuration options - Added CLI commands: config init, show, set-default, add-favorite, list-favorites - Updated .gitignore to exclude user-config.ncl (contains sensitive data) - Added USER-CONFIG.md with complete documentation - Updated README.adoc with configuration section - Added CONFIG-CHANGES.md summarizing changes The configuration system allows users to: - Set default server connections (host/port) - Maintain a list of favorite servers - Customize UI preferences and connection settings - Keep sensitive data out of version control Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
1 parent f54a765 commit ee8c737

7 files changed

Lines changed: 965 additions & 0 deletions

File tree

.github/workflows/casket-pages.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
name: GitHub Pages
3+
4+
on:
5+
push:
6+
branches: [main, master]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
24+
25+
- name: Checkout casket-ssg
26+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
27+
with:
28+
repository: hyperpolymath/casket-ssg
29+
path: .casket-ssg
30+
31+
- name: Setup GHCup
32+
uses: haskell-actions/setup@ec49483bfc012387b227434aba94f59a6ecd0900 # v2
33+
with:
34+
ghc-version: '9.8.2'
35+
cabal-version: '3.10'
36+
37+
- name: Cache Cabal
38+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
39+
with:
40+
path: |
41+
~/.cabal/packages
42+
~/.cabal/store
43+
.casket-ssg/dist-newstyle
44+
key: ${{ runner.os }}-casket-${{ hashFiles('.casket-ssg/casket-ssg.cabal') }}
45+
46+
- name: Build casket-ssg
47+
working-directory: .casket-ssg
48+
run: cabal build
49+
50+
- name: Prepare site source
51+
shell: bash
52+
run: |
53+
set -euo pipefail
54+
rm -rf .site-src _site
55+
56+
if [ -d site ]; then
57+
cp -R site .site-src
58+
else
59+
mkdir -p .site-src
60+
TODAY="$(date +%Y-%m-%d)"
61+
REPO_NAME="${{ github.event.repository.name }}"
62+
REPO_URL="https://github.com/${{ github.repository }}"
63+
README_URL=""
64+
65+
if [ -f README.md ]; then
66+
README_URL="${REPO_URL}/blob/${{ github.ref_name }}/README.md"
67+
elif [ -f README.adoc ]; then
68+
README_URL="${REPO_URL}/blob/${{ github.ref_name }}/README.adoc"
69+
fi
70+
71+
{
72+
echo "---"
73+
echo "title: ${REPO_NAME}"
74+
echo "date: ${TODAY}"
75+
echo "---"
76+
echo
77+
echo "# ${REPO_NAME}"
78+
echo
79+
echo "Static documentation site for ${REPO_NAME}."
80+
echo
81+
echo "- Source repository: [${{ github.repository }}](${REPO_URL})"
82+
if [ -n "${README_URL}" ]; then
83+
echo "- README: [project README](${README_URL})"
84+
fi
85+
if [ -d docs ]; then
86+
echo "- Docs directory: [docs/](${REPO_URL}/tree/${{ github.ref_name }}/docs)"
87+
fi
88+
echo
89+
echo "Project-specific site content can be added later under site/."
90+
} > .site-src/index.md
91+
fi
92+
93+
- name: Build site
94+
run: |
95+
mkdir -p _site
96+
cd .casket-ssg && cabal run casket-ssg -- build ../.site-src ../_site
97+
touch ../_site/.nojekyll
98+
99+
- name: Setup Pages
100+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
101+
102+
- name: Upload artifact
103+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
104+
with:
105+
path: '_site'
106+
107+
deploy:
108+
environment:
109+
name: github-pages
110+
url: ${{ steps.deployment.outputs.page_url }}
111+
runs-on: ubuntu-latest
112+
needs: build
113+
steps:
114+
- name: Deploy to GitHub Pages
115+
id: deployment
116+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ flake.lock
7878
*.key
7979
secrets/
8080

81+
# User configuration (contains sensitive server credentials)
82+
user-config.ncl
83+
8184
# Test/Coverage
8285
/coverage/
8386
htmlcov/

CONFIG-CHANGES.md

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
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`

README.adoc

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ The AI reads the manifest, asks you a few questions, and handles everything.
1616

1717
GSA can attach to _any_ game server, fingerprint it via protocol probing, extract its configuration into A2ML format, and provide a rich GUI for viewing, editing, and tracking config changes with full provenance.
1818

19+
**New in this version:** User-configurable server connections with support for default servers and favorites list. See <<Configuration>> for details.
20+
1921
=== Architecture
2022

2123
[source]
@@ -129,6 +131,47 @@ Each managed server is a VeriSimDB octad with all 8 modalities:
129131

130132
Dedicated instance on port 8090 with persistent storage and 15s drift detection.
131133

134+
== Configuration
135+
136+
GSA now supports user-specific configuration through a Nickel (`.ncl`) configuration file. This allows you to:
137+
138+
- Set a default server IP and port
139+
- Maintain a list of favorite servers
140+
- Customize UI preferences
141+
- Configure connection settings
142+
143+
=== Initial Setup
144+
145+
To create a default configuration file:
146+
147+
[source,bash]
148+
----
149+
./gsa config init
150+
----
151+
152+
This creates `user-config.ncl` from the template.
153+
154+
=== Configuration Commands
155+
156+
[source,bash]
157+
----
158+
# Show current configuration
159+
./gsa config show
160+
161+
# Set default server
162+
./gsa config set-default mc.example.com 25565
163+
164+
# Add a favorite server
165+
./gsa config add-favorite "My Minecraft" mc.example.com 25565
166+
167+
# List favorite servers
168+
./gsa config list-favorites
169+
----
170+
171+
=== Configuration File
172+
173+
The configuration file (`user-config.ncl`) is **gitignored** to ensure your server credentials remain private. See `USER-CONFIG.md` for complete documentation.
174+
132175
== License
133176

134177
SPDX-License-Identifier: PMPL-1.0-or-later

0 commit comments

Comments
 (0)