title: Specifying a default port in a Procfile
body: <p>I am using <code>foreman</code> to start a bunch of services, and have the following line in the Procfile.</p>
  
  <pre><code>web:    bundle exec rails server -p ${PORT:-3000}
  </code></pre>
  
  <p>yet when the server starts it starts on the default Foreman port of <code>5000</code>, so it looks like the syntax for injecting <code>3000</code> as the default port is wrong.</p>
  
  <p>I went looking (someone else gave me the line above so I'd like to fix it) and could not actually find any specific documentation on how to inject a default value.</p>
  
  <p>Looking at <a href="https://github.com/ddollar/foreman/blob/master/lib/foreman/process.rb#L34" rel="nofollow">the source</a> you see </p>
  
  <pre><code>def expanded_command(custom_env={})
    env = @options[:env].merge(custom_env)
    expanded_command = command.dup
    env.each do |key, val|
      expanded_command.gsub!("$#{key}", val)
    end
    expanded_command
  end
  </code></pre>
  
  <p>so it's clear that the <code>${PORT:-3000}</code> syntax is wrong.</p>
  
  <p>What is the correct way to set a default port?</p>