Skip to content

Add MCP_GATEWAY_LOG_DIR environment variable support for log directory configuration#148

Merged
pelikhan merged 4 commits into
mainfrom
copilot/add-log-dir-support-docker
Jan 11, 2026
Merged

Add MCP_GATEWAY_LOG_DIR environment variable support for log directory configuration#148
pelikhan merged 4 commits into
mainfrom
copilot/add-log-dir-support-docker

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 11, 2026

The MCP_GATEWAY_LOG_DIR environment variable was documented and used for validation in containerized mode but not actually respected by the CLI when determining the log directory.

Changes

  • Modified internal/cmd/root.go:

    • Added getDefaultLogDir() helper that checks MCP_GATEWAY_LOG_DIR environment variable
    • Updated --log-dir flag to use environment variable as default when set
    • Changed default log directory from /tmp/gh-aw/sandbox/mcp to /tmp/gh-aw/mcp-logs
  • Updated all documentation and scripts:

    • README.md: Updated default paths and examples
    • AGENTS.md: Updated reference to default log directory
    • Updated internal/config/env_validation.go fallback value
    • Updated run_containerized.sh script defaults
  • Added tests:

    • Unit test for getDefaultLogDir() behavior
    • Integration test verifying end-to-end functionality with environment variable

Priority Order

Log directory is now determined by:

  1. Explicit --log-dir flag (highest priority)
  2. MCP_GATEWAY_LOG_DIR environment variable
  3. Hardcoded default /tmp/gh-aw/mcp-logs

Usage

# Without environment variable
./awmg --help  # Shows default: /tmp/gh-aw/mcp-logs

# With environment variable
export MCP_GATEWAY_LOG_DIR=/custom/log/path
./awmg --help  # Shows default: /custom/log/path

# Explicit flag always wins
./awmg --log-dir /explicit/path  # Uses /explicit/path regardless of env var
Original prompt

Add support for specifying the log dir (MCP_GATEWAY_LOG_DIR) in dockerized mode as well (override default)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot default logs folder should be /tmp/gh-aw/mcp-logs/

Copilot AI and others added 2 commits January 11, 2026 13:40
- Modified internal/cmd/root.go to check MCP_GATEWAY_LOG_DIR env var
- Added getDefaultLogDir() helper function that returns env var value if set
- Created unit test for environment variable behavior
- Added integration test to verify MCP_GATEWAY_LOG_DIR works end-to-end
- All existing tests pass

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for specifying log dir in dockerized mode Add MCP_GATEWAY_LOG_DIR environment variable support for log directory configuration Jan 11, 2026
Copilot AI requested a review from pelikhan January 11, 2026 13:43
- Changed default log directory from /tmp/gh-aw/sandbox/mcp to /tmp/gh-aw/mcp-logs
- Updated internal/cmd/root.go constant
- Updated internal/config/env_validation.go fallback value
- Updated README.md documentation and examples
- Updated AGENTS.md reference
- Updated run_containerized.sh script defaults
- All tests pass with new default

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 11, 2026

@copilot default logs folder should be /tmp/gh-aw/mcp-logs/

Updated the default log directory to /tmp/gh-aw/mcp-logs/ in commit 94b1091. This changes:

  • The hardcoded default constant in internal/cmd/root.go
  • All documentation (README.md, AGENTS.md)
  • The validation and containerized scripts
  • All tests continue to pass

@pelikhan pelikhan marked this pull request as ready for review January 11, 2026 13:56
@pelikhan pelikhan merged commit d2a13f7 into main Jan 11, 2026
3 checks passed
@pelikhan pelikhan deleted the copilot/add-log-dir-support-docker branch January 11, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants