From c41c5e727722005ae9646d3cd927918f3a9d089b Mon Sep 17 00:00:00 2001 From: Stella Yang <43301578+lilacstella@users.noreply.github.com> Date: Wed, 31 Jul 2024 11:19:50 -0700 Subject: [PATCH] Configure process to complain about unset variable (#307) Co-authored-by: Richard Schneeman --- buildpacks/ruby/CHANGELOG.md | 2 ++ buildpacks/ruby/src/steps/get_default_process.rs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/buildpacks/ruby/CHANGELOG.md b/buildpacks/ruby/CHANGELOG.md index 16f49897..e7e2aebf 100644 --- a/buildpacks/ruby/CHANGELOG.md +++ b/buildpacks/ruby/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- The buildpack now warns the user when environmental variables used in running the default process are not defined. ([#307](https://github.com/heroku/buildpacks-ruby/pull/307)) + ## [3.0.0] - 2024-05-17 ### Changed diff --git a/buildpacks/ruby/src/steps/get_default_process.rs b/buildpacks/ruby/src/steps/get_default_process.rs index 8683411c..b2dba89e 100644 --- a/buildpacks/ruby/src/steps/get_default_process.rs +++ b/buildpacks/ruby/src/steps/get_default_process.rs @@ -76,7 +76,7 @@ fn default_rack() -> Process { "-c", &[ "bundle exec rackup", - "--port \"$PORT\"", + "--port \"${PORT:?Error: PORT env var is not set!}\"", "--host \"0.0.0.0\"", ] .join(" "), @@ -91,7 +91,7 @@ fn default_rails() -> Process { "-c", &[ "bin/rails server", - "--port \"$PORT\"", + "--port \"${PORT:?Error: PORT env var is not set!}\"", "--environment \"$RAILS_ENV\"", ] .join(" "),