Make bind address configurable for app dev server#6872
Open
lmcrean wants to merge 5 commits intoShopify:lmcrean-6355from
Open
Make bind address configurable for app dev server#6872lmcrean wants to merge 5 commits intoShopify:lmcrean-6355from
lmcrean wants to merge 5 commits intoShopify:lmcrean-6355from
Conversation
…documentation. This change ensures consistency across the application and improves clarity for users regarding the network interface settings.
…eters in setPortsAndAddProxyProcess call
…est to enhance readability and maintain consistency in configuration formatting.
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.
Adds configurable bind address support to the
shopify app devcommand to enable Docker container development workflows.Problem
localhostbinding for app dev servers for security0.0.0.0binding to accept connections from host machine--hostflag, but app dev server does notSolution
--hostflag toshopify app devcommand withSHOPIFY_FLAG_HOSTenv var support'localhost'127.0.0.1) while enabling Docker flexibilityChanges Made
1. Added host flag to app dev command
packages/app/src/cli/commands/app/dev.ts--hostflag with environment variable support127.0.0.1(maintains security)0.0.0.0(enables Docker containers)2. Updated proxy server to use configurable host
packages/app/src/cli/services/dev/processes/setup-dev-processes.ts'localhost'to use passed host parameterUsage Examples
For Docker containers:
SHOPIFY_FLAG_HOST=0.0.0.0 shopify app dev # or shopify app dev --host=0.0.0.0For normal development (default):
shopify app dev # Still binds to localhost by defaultTesting
Unit Tests
Added comprehensive unit test coverage in
packages/app/src/cli/services/dev/processes/setup-dev-processes.test.ts:New Test:
proxy server process includes host parameter when configured for Docker0.0.0.0for Docker compatibilityhost: '0.0.0.0'simulating Docker usageUpdated Existing Tests
All existing tests were updated to include the required
host: 'localhost'parameter incommandOptionsto satisfy TypeScripts' requirements for the Devoptions interface. Users get localhost by default so no action needed.Test Commands
Manual Testing
--host=0.0.0.0enables external connectionsSHOPIFY_FLAG_HOSTenvironment variable worksNo Breaking Changes
This is a feature addition that maintains 100% backward compatibility. Users who don't need Docker support will see zero changes in behavior. Only users who specifically want to bind to a different network interface need to use the new --host flag.
Previously #6396; this PR appears ready to merge