diff --git a/build.go b/build.go index a023a31..79875c9 100644 --- a/build.go +++ b/build.go @@ -43,12 +43,12 @@ func Build(logger scribe.Emitter) packit.BuildFunc { } logger.Debug.Break() - // Use RACK_ENV=production since Rack v1.6.0+ defaults the host to local host in development mode (default) + // Hardcode `--env production` since Rack v1.6.0+ defaults the host to local host in development mode (default) // The order of precedence in setting the port is: // 1. the $PORT variable if it is set // 2. A port listed in config.ru with the -p or --port flag // 3. 1 and 2 are not met, and the fallback port is set to the default of 9292. - args := fmt.Sprintf(`bundle exec rackup --env RACK_ENV=production -p "${PORT:-%s}"`, port) + args := fmt.Sprintf(`bundle exec rackup --env %s -p "${PORT:-%s}"`, "production", port) processes := []packit.Process{ { Type: "web", diff --git a/build_test.go b/build_test.go index 9f1cd21..d39d9ac 100644 --- a/build_test.go +++ b/build_test.go @@ -81,7 +81,7 @@ func testBuild(t *testing.T, context spec.G, it spec.S) { { Type: "web", Command: "bash", - Args: []string{"-c", `bundle exec rackup --env RACK_ENV=production -p "${PORT:-9292}"`}, + Args: []string{"-c", `bundle exec rackup --env production -p "${PORT:-9292}"`}, Default: true, Direct: true, }, @@ -126,7 +126,7 @@ func testBuild(t *testing.T, context spec.G, it spec.S) { { Type: "web", Command: "bash", - Args: []string{"-c", `bundle exec rackup --env RACK_ENV=production -p "${PORT:-3000}"`}, + Args: []string{"-c", `bundle exec rackup --env production -p "${PORT:-3000}"`}, Default: true, Direct: true, }, @@ -175,7 +175,7 @@ func testBuild(t *testing.T, context spec.G, it spec.S) { { Type: "web", Command: "bash", - Args: []string{"-c", `bundle exec rackup --env RACK_ENV=production -p "${PORT:-3000}"`}, + Args: []string{"-c", `bundle exec rackup --env production -p "${PORT:-3000}"`}, Default: true, Direct: true, }, diff --git a/integration/config_port_app_test.go b/integration/config_port_app_test.go index b0e773c..3914c52 100644 --- a/integration/config_port_app_test.go +++ b/integration/config_port_app_test.go @@ -84,7 +84,7 @@ func testConfigPortApp(t *testing.T, context spec.G, it spec.S) { " config.ru specifies a port: 3000", "", " Assigning launch processes:", - ` web (default): bash -c bundle exec rackup --env RACK_ENV=production -p "${PORT:-3000}"`, + ` web (default): bash -c bundle exec rackup --env production -p "${PORT:-3000}"`, )) Eventually(func() string { @@ -133,7 +133,7 @@ func testConfigPortApp(t *testing.T, context spec.G, it spec.S) { MatchRegexp(fmt.Sprintf(`%s \d+\.\d+\.\d+`, settings.Buildpack.Name)), " Writing start command", " Assigning launch processes:", - ` web (default): bash -c bundle exec rackup --env RACK_ENV=production -p "${PORT:-3000}"`, + ` web (default): bash -c bundle exec rackup --env production -p "${PORT:-3000}"`, )) Eventually(func() string { diff --git a/integration/simple_app_test.go b/integration/simple_app_test.go index 8b70539..4586e29 100644 --- a/integration/simple_app_test.go +++ b/integration/simple_app_test.go @@ -81,7 +81,7 @@ func testSimpleApp(t *testing.T, context spec.G, it spec.S) { MatchRegexp(fmt.Sprintf(`%s \d+\.\d+\.\d+`, settings.Buildpack.Name)), " Writing start command", " Assigning launch processes:", - ` web (default): bash -c bundle exec rackup --env RACK_ENV=production -p "${PORT:-9292}"`, + ` web (default): bash -c bundle exec rackup --env production -p "${PORT:-9292}"`, )) }) }) @@ -117,7 +117,7 @@ func testSimpleApp(t *testing.T, context spec.G, it spec.S) { MatchRegexp(fmt.Sprintf(`%s \d+\.\d+\.\d+`, settings.Buildpack.Name)), " Writing start command", " Assigning launch processes:", - ` web (default): bash -c bundle exec rackup --env RACK_ENV=production -p "${PORT:-9292}"`, + ` web (default): bash -c bundle exec rackup --env production -p "${PORT:-9292}"`, )) }) }) diff --git a/integration/sinatra_app_test.go b/integration/sinatra_app_test.go index fb55784..10ee43b 100644 --- a/integration/sinatra_app_test.go +++ b/integration/sinatra_app_test.go @@ -80,7 +80,7 @@ func testSinatraApp(t *testing.T, context spec.G, it spec.S) { MatchRegexp(fmt.Sprintf(`%s \d+\.\d+\.\d+`, settings.Buildpack.Name)), " Writing start command", " Assigning launch processes:", - ` web (default): bash -c bundle exec rackup --env RACK_ENV=production -p "${PORT:-9292}"`, + ` web (default): bash -c bundle exec rackup --env production -p "${PORT:-9292}"`, )) }) })