Skip to content

Instantly share code, notes, and snippets.

@brianmarete
Created April 26, 2019 11:57
Show Gist options
  • Save brianmarete/0f2a3c3bfbccf2b8c0cf4097ea2a1bc5 to your computer and use it in GitHub Desktop.
Save brianmarete/0f2a3c3bfbccf2b8c0cf4097ea2a1bc5 to your computer and use it in GitHub Desktop.
public class App {
public static void main(String[] args) {
ProcessBuilder process = new ProcessBuilder();
Integer port;
// This tells our app that if Heroku sets a port for us, we need to use that port.
// Otherwise, if they do not, continue using port 4567.
if (process.environment().get("PORT") != null) {
port = Integer.parseInt(process.environment().get("PORT"));
} else {
port = 4567;
}
port(port);
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment