Fix unbound variable error in firewall script#6
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixed unbound variable error in init-firewall.sh that was preventing container startup
Problem
The firewall initialization script was failing with:
This occurred because the script uses
set -u(fail on unbound variables) andCUSTOM_ALLOWED_DOMAINSis optional.Solution
Use parameter expansion with default empty value:
${CUSTOM_ALLOWED_DOMAINS:-}instead of$CUSTOM_ALLOWED_DOMAINSThis allows the script to handle the case where the variable is not set without failing.
Test plan