Skip to content

Conversation

@richardkiene
Copy link
Contributor

Summary

This PR introduces two key improvements to the devcontainer:

  • Optional firewall logging: Adds configurable, rate-limited logging for debugging network connectivity issues
  • Automatic .env loading: Fixes direnv configuration to automatically load environment variables from .env files

Features Added

Firewall Logging

  • Rate-limited logging (10 packets/minute by default) to prevent log spam
  • Configurable via environment variables (FIREWALL_LOG_ENABLED, FIREWALL_LOG_RATE)
  • Helps debug blocked network requests during development
  • Comprehensive documentation in docs/firewall-logging.md
  • Logging configuration added to docker-compose.yml and .env.example

Direnv Environment Loading

  • Configures direnv with dotenv_if_exists to automatically load .env files
  • Adds .envrc template file for immediate use
  • Updates documentation with environment variable loading instructions
  • Improves developer experience by eliminating manual environment setup

Test Plan

  • Verify firewall logging works when enabled via environment variables
  • Test that .env files are automatically loaded when entering directories
  • Confirm rate limiting prevents log spam
  • Validate that existing functionality remains unaffected
  • Test direnv integration in both bash and zsh shells

Both features enhance the development experience while maintaining the container's security model.

Introduces comprehensive logging functionality to the devcontainer firewall
system to help developers debug network connectivity problems:

- Enhanced init-firewall.sh with configurable logging levels and destinations
- Added environment variables for firewall logging configuration
- Created detailed documentation for logging setup and usage
- Updated examples and README with logging references
- Supports syslog and file-based logging with configurable verbosity

This feature is disabled by default to maintain performance and only
activates when explicitly configured via environment variables.
- Configure direnv with dotenv_if_exists in direnvrc for automatic .env loading
- Add .envrc template file to enable safe environment variable loading
- Update README with environment variable loading documentation
- Ensure proper ownership of direnv configuration files

This complements the firewall logging feature by improving environment
variable management and making the development environment more seamless.
@richardkiene richardkiene merged commit c70c684 into main Aug 28, 2025
4 checks passed
@richardkiene richardkiene deleted the feature/firewall-logging-and-direnv-fix branch August 28, 2025 00:44
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