Skip to content

Conversation

@richardkiene
Copy link
Contributor

Summary

Fixed unbound variable error in init-firewall.sh that was preventing container startup

Problem

The firewall initialization script was failing with:

/usr/local/bin/init-firewall.sh: line 80: CUSTOM_ALLOWED_DOMAINS: unbound variable

This occurred because the script uses set -u (fail on unbound variables) and CUSTOM_ALLOWED_DOMAINS is optional.

Solution

Use parameter expansion with default empty value: ${CUSTOM_ALLOWED_DOMAINS:-} instead of $CUSTOM_ALLOWED_DOMAINS

This allows the script to handle the case where the variable is not set without failing.

Test plan

  • Merge and rebuild Docker image
  • Start devcontainer without setting CUSTOM_ALLOWED_DOMAINS
  • Verify firewall script completes successfully
  • Test with CUSTOM_ALLOWED_DOMAINS set to verify it still works

Remove direnv feature from devcontainer.json and install direnv directly
in Dockerfile to resolve TypeError preventing container initialization
Use parameter expansion with default empty value for CUSTOM_ALLOWED_DOMAINS
to prevent script failure when variable is not defined and set -u is enabled.
- Created docker-compose.yml to replace direct image configuration
- Updated devcontainer.json to use Docker Compose service
- Re-added CUSTOM_ALLOWED_DOMAINS support with working env vars
- Moved .env.example to .devcontainer/ directory for proper scoping
- Added .gitignore to prevent committing personal .env files
- Updated README with new configuration paths and Docker Compose usage
- Modified firewall script to handle CUSTOM_ALLOWED_DOMAINS from env

This enables .env files in .devcontainer/ to be automatically loaded
by Docker Compose, making environment variables work without requiring
system-level configuration.
- Move allowed-domains.txt.example to .devcontainer/ directory
- Update init-firewall.sh to look for allowed-domains.txt in .devcontainer/
- Update .gitignore to handle new allowed-domains.txt location
- Update documentation and examples to reflect new location
- Improves organization by keeping all devcontainer config in one place
Add environment variables for flexible SOCKS5 proxy configuration:
- SOCKS5_ENABLED: Enable/disable proxy access
- SOCKS5_HOST: Configurable proxy host (hostname or IP)
- SOCKS5_PORT: Configurable proxy port

Replaces hardcoded host.docker.internal:1080 with dynamic configuration
while maintaining backward compatibility. Updates documentation with
configuration examples for common proxy scenarios.
@richardkiene richardkiene merged commit 74a6fa5 into main Aug 22, 2025
1 check passed
@richardkiene richardkiene deleted the fix/firewall-unbound-variable branch August 22, 2025 21:55
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