From 3137c241896976fbb39591be777c685180f93afb Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Thu, 16 Feb 2023 11:51:35 +0100 Subject: [PATCH] Default to port 3000 while allowing override With this configuration `bin/dev` will use port 3000, but `bin/dev -p 3001` will correctly start the server on port 3001. --- lib/install/Procfile.dev | 2 +- lib/install/dev | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/install/Procfile.dev b/lib/install/Procfile.dev index faaa758..b19ff76 100644 --- a/lib/install/Procfile.dev +++ b/lib/install/Procfile.dev @@ -1,2 +1,2 @@ -web: unset PORT && env RUBY_DEBUG_OPEN=true bin/rails server +web: env RUBY_DEBUG_OPEN=true bin/rails server js: yarn build --watch diff --git a/lib/install/dev b/lib/install/dev index 74ade16..a4e05fa 100755 --- a/lib/install/dev +++ b/lib/install/dev @@ -5,4 +5,7 @@ if ! gem list foreman -i --silent; then gem install foreman fi +# Default to port 3000 if not specified +export PORT="${PORT:-3000}" + exec foreman start -f Procfile.dev "$@"