Skip to content

Commit 7aaf3c6

Browse files
committed
feat(games): default gamedata_dir to /usr/local/homer-core/gamedata
Matches the package install prefix, so a packaged deployment only needs to download the WAD — no config edit. A missing directory yields plain 404s and the widget shows the provisioning hint; explicit empty string still disables the /gamedata/ route (struct-tag defaults are seeded before unmarshal, so file-present values win).
1 parent b1e282d commit 7aaf3c6

4 files changed

Lines changed: 16 additions & 13 deletions

File tree

docs/COORDINATOR.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Authorization **code** flow (server exchanges `code`, loads userinfo, provisions
192192
| `read_timeout` | int | 30 | Read timeout in seconds |
193193
| `write_timeout` | int | 30 | Write timeout in seconds |
194194
| `static_path` | string | "" | Path to UI static files (optional) |
195-
| `gamedata_dir` | string | "" | On-disk directory served read-only at `/gamedata/` for large game assets (Doom widget IWAD). Empty disables the route. See `docs/VOIPGames.md`. |
195+
| `gamedata_dir` | string | "/usr/local/homer-core/gamedata" | On-disk directory served read-only at `/gamedata/` for large game assets (Doom widget IWAD). A missing directory yields 404s; empty string disables the route. See `docs/VOIPGames.md`. |
196196

197197
### nodes
198198

docs/VOIPGames.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -335,17 +335,17 @@ over same-origin `postMessage` (`doomWad.ts` validates the frames).
335335

336336
The shareware `doom1.wad` is freely distributable but deliberately kept out
337337
of the repo, the UI bundle, and the `go:embed` binary. On the coordinator
338-
host:
338+
host (the script ships with the deb/rpm under
339+
`/usr/local/homer-core/scripts/`):
339340

340341
```bash
341-
./scripts/fetch-doom-wad.sh /usr/local/homer-core/gamedata
342+
sudo /usr/local/homer-core/scripts/fetch-doom-wad.sh /usr/local/homer-core/gamedata
342343
```
343344

344-
then set the config and restart:
345-
346-
```json
347-
{ "coordinator": { "http_server": { "gamedata_dir": "/usr/local/homer-core/gamedata" } } }
348-
```
345+
`gamedata_dir` defaults to `/usr/local/homer-core/gamedata`, so with the
346+
package layout no config change is needed — just download the WAD. To serve
347+
from another directory set `coordinator.http_server.gamedata_dir`; an empty
348+
string disables the `/gamedata/` route entirely.
349349

350350
Any IWAD/PWAD named `doom1.wad` in that directory works (full Doom,
351351
Freedoom Phase 1 renamed — note vanilla visplane limits apply). If the WAD

src/config/config.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,9 @@ type CoordinatorHTTPServerConfig struct {
710710
StaticPath string `json:"static_path" mapstructure:"static_path" default:""`
711711
// GamedataDir is an on-disk directory served read-only at /gamedata/.
712712
// Used for large game assets (e.g. the Doom widget IWAD) that must not
713-
// be embedded into the binary via go:embed. Empty = route disabled.
714-
GamedataDir string `json:"gamedata_dir" mapstructure:"gamedata_dir" default:""`
713+
// be embedded into the binary via go:embed. The default matches the
714+
// package install prefix; a missing directory simply yields 404s.
715+
GamedataDir string `json:"gamedata_dir" mapstructure:"gamedata_dir" default:"/usr/local/homer-core/gamedata"`
715716
}
716717

717718
// NodeEndpoint defines a FlightSQL node to query
@@ -1256,6 +1257,7 @@ func setDefaults(v *viper.Viper) {
12561257
v.SetDefault("coordinator.http_server.enable", true)
12571258
v.SetDefault("coordinator.http_server.host", "0.0.0.0")
12581259
v.SetDefault("coordinator.http_server.port", 8080)
1260+
v.SetDefault("coordinator.http_server.gamedata_dir", "/usr/local/homer-core/gamedata")
12591261
v.SetDefault("coordinator.settings_db_path", "/var/lib/homer/homer_settings.duckdb")
12601262
v.SetDefault("coordinator.lake_name", "homer_lake")
12611263
v.SetDefault("coordinator.jwt.expire_hours", 24)

src/ui/src/dashboard/widgets/DoomPanel.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,12 @@ export default function DoomPanel() {
144144
the coordinator host run:
145145
</p>
146146
<code className="rounded bg-muted px-2 py-1 text-[11px]">
147-
./scripts/fetch-doom-wad.sh /path/to/gamedata
147+
scripts/fetch-doom-wad.sh /usr/local/homer-core/gamedata
148148
</code>
149149
<p className="max-w-80 text-center text-xs text-muted-foreground">
150-
and set <code className="text-[11px]">coordinator.http_server.gamedata_dir</code> to
151-
that directory, then restart homer-core.
150+
(default <code className="text-[11px]">gamedata_dir</code>; override via{' '}
151+
<code className="text-[11px]">coordinator.http_server.gamedata_dir</code>, then
152+
restart homer-core)
152153
</p>
153154
<Button size="sm" variant="outline" className="h-6 px-2 text-xs" onClick={start}>
154155
Retry

0 commit comments

Comments
 (0)