Skip to content

refactor(gateway): default gateway binary and logs to the home dir - #1129

Merged
edenreich merged 4 commits into
mainfrom
fix/issue-1123
Aug 30, 2026
Merged

edenreich merged 4 commits into
mainfrom
fix/issue-1123

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Resolves #1123

Summary

Makes ~/.infer/ the single default location for machine-scoped state: the downloaded gateway binary now lands in ~/.infer/bin/ (one shared copy per machine instead of one per project), and both CLI and gateway logs default to ~/.infer/logs/. The daemon-only home fallback in ConfigureDaemonLogging() collapses into the new default, and an explicit logging.dir config value still wins everywhere. Per the issue there is no backward compatibility or migration - old project-local .infer/bin and .infer/logs in projects are simply orphaned.

Changes

  • config/config.go: replace the project-relative DefaultLogsPath const with DefaultLogsDir(), mirroring TelemetryDir() (resolves ~/.infer/logs; falls back to a relative path only when $HOME is unknown); explicit logging.dir still overrides
  • internal/gateway/manager.go: downloadBinary() targets ~/.infer/bin (staleness check unchanged) and configureGatewayOutput() writes gateway-.log under ~/.infer/logs, honoring logging.dir when set; added a small inferHomeDir() helper that inferRunDir() now reuses, so the gateway lifecycle (run/, pids/, bin/, logs/) is fully home-scoped
  • internal/platform/logger/logger.go: the empty-LogDir fallback now uses config.DefaultLogsDir()
  • cmd/runtime/state.go: Initialize() uses config.DefaultLogsDir(); the daemon-specific home override in ConfigureDaemonLogging() is removed as redundant - it only sets the daemon prefix and stdout now
  • cmd/runtime/state_test.go: TestMain comment updated for the home-based default (the INFER_LOGGING_DIR override it already sets is what keeps hermetic)
  • config/gitignore.go: bin/ and logs/*.log entries removed from the seeded project .gitignore (nothing writes them to the project dir anymore); comments updated
  • config/logs_dir_test.go: new tests pinning the ~/.infer/logs default and the gitignore removal
  • docs: configuration-reference.md and the a2a/mcp troubleshooting snippets now document ~/.infer/logs as the default; directory-structure.md moves logs/ and bin/ to the userspace ~/.infer tree and drops the project-local bullets

Trigger

Comment from @edenreich asking to implement this task.

downloadBinary() targets ~/.infer/bin and gateway/CLI logs default to config.DefaultLogsDir() (~/.infer/logs), honoring an explicit logging.dir; the daemon-only home override in ConfigureDaemonLogging() collapses into the shared default.

bin/ and logs/*.log leave the seeded project gitignore since nothing writes them to the project dir; in-repo docs updated. No migration - old project .infer/bin and .infer/logs are simply orphaned (per issue).
Comment thread cmd/runtime/state.go Resolved
Comment thread internal/gateway/manager.go Resolved
Comment thread config/config.go Resolved
@edenreich
edenreich merged commit 99e004c into main Aug 30, 2026
1 check passed
@edenreich
edenreich deleted the fix/issue-1123 branch August 30, 2026 14:41
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.185.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TASK] Refactor gateway binary and log defaults to the home dir

1 participant